#include <iostream.h>
#include <iomanip.h>
void main()
{
int m,n;
cin >> m >> n;
for ( int i=1;i<=m; i++)
{
if(i=1)
{
for ( int j=1; j<=n; j++)
{
cout << "*" ;
}
cout << endl;
}
else if(i>1 && i<m) cout << "*" << setw(n-2) << "*" << endl;
else if(i=m)
{
for(int k=1; k<=n; k=k+1)
{
cout << "*";
}
}
}
}
