#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
char n;
cin>>a>>b>>n>>c;
if(c==0){
for(int i=1;i<=b;i++){
cout<<n;
}
for(int i=1;i<=b-2;i++){
cout<<n<<endl;
for(int j=1;j<=b-2;j++){
cout<<" ";
}
cout<<n<<endl;
}
for(int i=1;i<=b;i++){
cout<<n;
}
}
if(c==1){
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
cout<<n;
}
cout<<endl;
}
}
return 0;
}