while True:
a, row = raw_input().strip().split()
row = int(row)
if a == '@':
break
k = 1
for i in range(1,row+1):
if i == 1:
print ' '*(row-1) + a
elif i == row:
print a*(2*row-1)
else:
print ' '*(row-i)+a+' '*k+a
k+=2
print