#include <bits/stdc++.h>
using namespace std;

int main()
{
    char c1, c2;
    cin >> c1 >> c2;
    int m, n;
    cin >> m >> n;

    if(m == n)
    {
        for(int i = 0; i < m; i++)
        {
            cout << c1 << c2;
        }
    }
    else if(m == n+1)
    {
        for(int i = 0; i < m-1; i++)
        {
            cout << c1 << c2;
        }
        cout << c1;
    }
    else if(n == m+1)
    {
        for(int i = 0; i < n-1; i++)
        {
            cout << c2 << c1;
        }
        cout << c2;
    }
    return 0;

}