r=int(input("Rows "))
c=int(input("Columns "))
//Iterate over the rows
for i in range(r):
//Iterate over the columns
for j in range(c):
// print star if row no is 0 or no of rows-1
// print star if column no is 0 or no of column-1
if(i==0 or i==(r-1) or
j==0 or j==(c-1)):
print("*",end=" ")
//else print space
else:
print(" ",end=" ")
print()