(送给蒟蒻)
#include <iostream>
using namespace std;
int main()
{
int a,b,f;
char c;
cin>>a>>b>>c>>f;
for(int s=0;s<b;s++) cout<<c;
cout<<endl;
for(int i=0;i<a-2;i++)
{
cout<<c;
for(int i=0;i<b-2;i++)
{
cout<<(f ? c : ' ');
}
cout<<c<<endl;
}
for(int w=0;w<b;w++) cout<<c;
}