#include <bits/stdc++.h>
using namespace std;
const int N = 30;
int A[N], B[N], C[N];
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  int la = a.length(), lb = b.length(), lc = c.length();
  for (int i = 0; i < la; i++) A[a[i] - 'a']++;
  for (int i = 0; i < lb; i++) B[b[i] - 'a']++;
  for (int i = 0; i < lc; i++) C[c[i] - 'a']++;
  int best = 0, mx = 0;
  for (int i = 0; i * lb <= la; i++) {
    bool p = true;
    for (int j = 0; j < 26; j++) {
      if (A[j] < i * B[j]) {
        p = false;
        break;
      }
    }
    if (!p) break;
    int x = la;
    for (int j = 0; j < 26; j++) {
      if (C[j] > 0) {
        x = min(x, (A[j] - i * B[j]) / C[j]);
      }
    }
    if (i + x > mx) {
      best = i;
      mx = i + x;
    }
  }
  for (int i = 0; i < best; i++) printf("%s", b.c_str());
  for (int i = 0; i < mx - best; i++) printf("%s", c.c_str());
  for (int i = 0; i < 26; i++) {
    A[i] -= best * B[i] + (mx - best) * C[i];
    while (A[i] > 0) {
      printf("%c", i + 'a');
      A[i]--;
    }
  }
  printf("\n");
  return 0;
}
