while True:
try:
n=list(map(str,input().split()))
m=n[0]
if m=='@':break
a=int(n[1])
print(' '*(a-1),m,sep='')
for i in range(2,a):
print(' '*(a-i),m,' '*((i-1)*2-1),m,sep='')
if a!=1:print(m*(2*a-1),sep='')
print()
except EOFError:
break