#include <bits/stdc++.h>
using namespace std;
int fa[100005], fb[100005], fc[100005];
int main() {
  string a, b, c, ans = "";
  cin >> a >> b >> c;
  int i, j, k, l;
  for (i = 0; i < int((a).size()); i++) {
    fa[a[i] - 'a']++;
  }
  for (i = 0; i < int((b).size()); i++) {
    fb[b[i] - 'a']++;
  }
  for (i = 0; i < int((c).size()); i++) {
    fc[c[i] - 'a']++;
  }
  int times1 = INT_MAX, flag1 = 0, flag2 = 0, times2 = INT_MAX;
  for (i = 0; i < 26; i++) {
    if (fb[i]) {
      times1 = min(times1, fa[i] / fb[i]);
      flag1 = 1;
    }
  }
  for (i = 0; i < 26; i++) {
    if (fc[i]) {
      flag2 = 1;
      times2 = min(times2, fa[i] / fc[i]);
    }
  }
  int maxtimes1 = 0, maxtimes2 = 0, maxtotal = 0, curtimes2, curtimes1;
  for (i = 0; i <= times1 + times2 + 5; i++) {
    curtimes1 = INT_MAX;
    for (k = 0; k < 26; k++) {
      if (fb[k]) {
        curtimes1 = min(curtimes1, fa[k] / fb[k]);
        flag1 = 1;
      }
    }
    int t = min(i, times1);
    for (k = 0; k < 26; k++) {
      if (fb[k]) {
        fa[k] -= (t * fb[k]);
      }
    }
    curtimes2 = INT_MAX;
    for (l = 0; l < 26; l++) {
      if (fc[l]) {
        flag2 = 1;
        curtimes2 = min(curtimes2, fa[l] / fc[l]);
      }
    }
    if (curtimes2 + t > maxtotal) {
      maxtimes1 = t;
      maxtimes2 = curtimes2;
      maxtotal = curtimes2 + i;
    }
    for (k = 0; k < 26; k++) {
      if (fb[k]) {
        fa[k] += (t * fb[k]);
      }
    }
  }
  if (flag2) {
    for (i = 0; i < maxtimes2; i++) ans += c;
    for (i = 0; i < 26; i++) {
      if (fc[i]) {
        fa[i] -= maxtimes2 * fc[i];
      }
    }
  }
  if (flag1) {
    for (i = 0; i < maxtimes1; i++) ans += b;
    for (i = 0; i < 26; i++) {
      if (fb[i]) {
        fa[i] -= (maxtimes1 * fb[i]);
      }
    }
  }
  for (i = 0; i < 26; i++) {
    while (fa[i] > 0) {
      --fa[i];
      ans += i + 'a';
    }
  }
  cout << ans << endl;
  return 0;
}
