#include<bits/stdc++.h>
using namespace std;
int main() {
int a,b,f;
char c;
cin>>a>>b>>c>>f;
if(f==0){
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
if(i==1&&j==1||i==a&&j==b){
for(int j=1;j<=b;j++){
cout<<c;
if(j==b) cout<<endl;
}
} else {
if(j==2){
cout<<c;
for(int j=2;j<=b-1;j++) cout<<" ";
cout<<c;
cout<<endl;
}
}
}
}
} else{
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
cout<<c;
}
cout<<endl;
}
}
return 0;
}
各路大神求解