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