while True:
n=list(map(str,input().split()))
if n[0]=='@':
break
a=n[0]
b=int(n[1])
for i in range(1,b+1):
if i ==1:
print(' '*(b-1) + a)
elif i==b:
print(a*(2*i-1))
else:
print(' '*(b-i)+a+' '*(2*i-3)+a)
print()