#!/usr/bin/python
#-*-coding:utf-8 -*-
while True:
list=raw_input().strip().split()
if list[0]=="@":
break
else:
a=list[0]
b=int(list[1])
for i in range(1,b+1):
if i==1:
print " "*(b-1)+a
elif i==b and b!=1:
print a*(b*2-1)
if i!=1 and i!=b:
print " "*(b-i)+a+" "*((i-1)*2-1)+a
print