while True:
a=map(str,raw_input().strip().split())
if a[0]=="@":
break
else:
n=int(a[1])
if n==1:
print a[0]*(2*n-1)+"\n"
else:
print " "*(n-1)+a[0]
for i in range(n-2,0,-1):
print " "*i+a[0]+" "*(2*n-3-i-i)+a[0]
print a[0]*(2*n-1)+"\n"