#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
const int delt = 255;
long long fa[N], fb[N], fc[N];
int main() {
  ios::sync_with_stdio(false);
  string a, b, c;
  cin >> a;
  cin >> b;
  cin >> c;
  for (int i = 0; i < a.size(); i++) {
    fa[a[i] + delt]++;
  }
  for (int i = 0; i < b.size(); i++) {
    fb[b[i] + delt]++;
  }
  for (int i = 0; i < c.size(); i++) {
    fc[c[i] + delt]++;
  }
  pair<long long, pair<long long, long long> > ans = {0, {0, 0}};
  for (int j = 0; j <= a.size(); j++) {
    long long kb = j;
    bool was = 0;
    for (char i = 'a'; i <= 'z'; i++) {
      if (fa[i + delt] < kb * fb[i + delt]) {
        was = 1;
        break;
      }
    }
    if (was) continue;
    long long kc = (long long)1e15;
    for (char i = 'a'; i <= 'z'; i++) {
      if (fc[i + delt] > 0)
        kc = min(kc, (fa[i + delt] - kb * fb[i + delt]) / fc[i + delt]);
    }
    ans = max(ans, make_pair(kb + kc, make_pair(kb, kc)));
  }
  for (char i = 'a'; i <= 'z'; i++) {
    fa[i + delt] -= ans.second.first * fb[i + delt];
    fa[i + delt] -= ans.second.second * fc[i + delt];
  }
  string str = "";
  for (int i = 0; i < ans.second.first; i++) {
    str += b;
  }
  for (int i = 0; i < ans.second.second; i++) {
    str += c;
  }
  for (char i = 'a'; i <= 'z'; i++) {
    while (fa[i + delt] > 0) {
      str += i;
      fa[i + delt]--;
    }
  }
  cout << str << "\n";
  return 0;
}
