#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,d;
char c;
int e=0,f=0;
cin>>a>>b>>c>>d;
if(d==0)
{
while(d<a)
{
while(f<b)
{
if(d==0)
{
cout<<c;
}
else if(d==a-1)
{
cout<<c;
}
else
{
if(f==0)
{
cout<<c;
}
else if(f==b-1)
{
cout<<c;
}
else
{
cout<<" ";
}
}
f++;
}
f=0;
cout<<endl;
d++;
}
}
else
{
while(d<a)
{
while(f<b)
{
cout<<c;
f++;
}
f=0;
cout<<endl;
d++;
}
}
return 0;
}