#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  int cnt_a[26], cnt_b[26], cnt_c[26];
  memset(cnt_a, 0, sizeof(cnt_a));
  memset(cnt_b, 0, sizeof(cnt_b));
  memset(cnt_c, 0, sizeof(cnt_c));
  for (int i = 0; i < a.size(); ++i) {
    cnt_a[a[i] - 'a']++;
  }
  for (int i = 0; i < b.size(); ++i) {
    cnt_b[b[i] - 'a']++;
  }
  for (int i = 0; i < c.size(); ++i) {
    cnt_c[c[i] - 'a']++;
  }
  int cnt[26];
  memset(cnt, 0, sizeof(cnt));
  int num = 0;
  int x = 0, y = 0;
  while (1) {
    int cur = 1000000000;
    for (int i = 0; i < 26; ++i) {
      if (cnt_a[i] - cnt[i] < 0) {
        cur = -1;
        break;
      }
      if (cnt_c[i] == 0) {
        continue;
      }
      cur = min(cur, (cnt_a[i] - cnt[i]) / cnt_c[i]);
    }
    if (cur == -1) {
      break;
    } else {
      if (x + y < num + cur) {
        x = num;
        y = cur;
      }
    }
    num++;
    for (int i = 0; i < 26; ++i) {
      cnt[i] += cnt_b[i];
    }
  }
  for (int i = 0; i < x; ++i) {
    cout << b;
  }
  for (int i = 0; i < y; ++i) {
    cout << c;
  }
  for (int i = 0; i < 26; ++i) {
    cnt_a[i] -= cnt_b[i] * x + cnt_c[i] * y;
  }
  for (int i = 0; i < 26; ++i) {
    for (int j = 0; j < cnt_a[i]; ++j) {
      cout << char(i + 'a');
    }
  }
  cout << endl;
  return 0;
}
