while True:
a = raw_input().strip().split()
if a[0] == '@':
break
else:
n=int(a[1])
if n == 1:
print a[0]
print ''
continue;
print ' '*(n-1)+a[0]
for i in range(2,n):
print ' '*(n-i)+a[0]+' '*(2*(i-1)-1)+a[0]
print a[0]*(2*n-1)
print ''