#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
vector<int> p;
map<char, int> ka, kb, kc;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  for (int i = 0; i < (int)a.size(); i++) {
    ka[a[i]]++;
  }
  for (int i = 0; i < (int)b.size(); i++) {
    kb[b[i]]++;
  }
  for (int i = 0; i < (int)c.size(); i++) {
    kc[c[i]]++;
  }
  int mxb = 2 * (int)a.size(), mxc = 2 * a.size();
  for (map<char, int>::iterator it = kb.begin(); it != kb.end(); it++) {
    mxb = min(mxb, ka[it->first] / it->second);
  }
  int ansb = mxb, ansc = 0;
  int ans = mxb;
  for (int i = 0; i <= mxb; i++) {
    int mxxc = INF;
    for (map<char, int>::iterator it = kc.begin(); it != kc.end(); it++) {
      mxxc = min(mxxc, (ka[it->first] - kb[it->first] * i) / it->second);
    }
    if (i + mxxc > ans) {
      ans = i + mxxc;
      ansb = i;
      ansc = mxxc;
    }
  }
  for (int i = 0; i < ansb; i++) {
    cout << b;
  }
  for (int i = 0; i < ansc; i++) {
    cout << c;
  }
  for (char i = 'a'; i <= 'z'; i++) {
    for (int j = 0; j < ka[i] - kb[i] * ansb - kc[i] * ansc; j++) {
      cout << i;
    }
  }
}
