#include using namespace std; int main() { int h, w, fill; char c; cin >> h >> w >> c >> fill; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (j == 0 || j == w - 1 || i == 0 || i == h - 1) cout << c; else if (fill) { cout << c; } else { cout << ' '; } } cout << endl; } return 0; }