#!/usr/bin/python #-*-coding:utf-8 -*- i,j = map(int,raw_input().strip().split()) m=1 n=1 s="" while m<=i: while n<=j: if (m<>1 and m<>i and n<>1 and n<>j): s=s+' ' else: s=s+"*" n=n+1 print s m=m+1 s="" n=1