while True:
n = map(str,raw_input().strip().split())
a = n[0]
if a == '@':
break
b = int(n[1])
sg = ''
for i in range(b+1) :
if i == 1:
print ' '*(b-1) + a
elif i == b:
print a*(2*b-1)
elif i >1 and i <b :
print ' '*(b-i) + a + ' '*(2*i-3) + a
print