#include <bits/stdc++.h>
using namespace std;
int cnt[3][26], tmp[26];
int main() {
  string str[3];
  cin >> str[0] >> str[1] >> str[2];
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < str[i].length(); j++) cnt[i][str[i][j] - 'a']++;
  int c1 = 0, c2 = 0;
  bool flag = true;
  for (int k = 0;; k++) {
    for (int i = 0; i < 26; i++) tmp[i] = cnt[0][i];
    for (int i = 0; i < 26; i++)
      if (cnt[1][i] != 0) {
        tmp[i] -= k * cnt[1][i];
        if (tmp[i] < 0) flag = false;
      }
    if (!flag) break;
    int mn = 100000;
    for (int i = 0; i < 26; i++)
      if (cnt[2][i] != 0) mn = min(mn, tmp[i] / cnt[2][i]);
    if (mn == 100000) mn = 0;
    if (k + mn > c1 + c2) c1 = k, c2 = mn;
  }
  for (int i = 0; i < c1; i++) cout << str[1];
  for (int i = 0; i < c2; i++) cout << str[2];
  for (int i = 0; i < 26; i++) {
    cnt[0][i] -= (cnt[1][i] * c1) + (cnt[2][i] * c2);
    for (int j = 0; j < cnt[0][i]; j++) cout << (char)(i + 'a');
  }
  cout << endl;
  return 0;
}
