a=raw_input() b=int(a[0]) c=int(a[2]) for i in range(1,b+1): if i!=1 and i!=b: print '*'+' '*(c-2)+'*' else: print '*'*c