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