#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:667772160")
using namespace std;
struct __isoff {
  __isoff() {
    if (0) freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    srand(time(0));
  }
  ~__isoff() {}
} __osafwf;
const unsigned long long p1 = 31;
const unsigned long long p2 = 29;
const double eps = 1e-8;
const double pi = acos(-1.0);
const long long inf = 1e18 + 7;
const int infi = 1e9 + 7;
const long long dd = 3e5 + 7;
const long long mod = 1e9 + 7;
int A[128], B[128], C[128];
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  for (long long i = 0; i < (long long)a.size(); i++) A[a[i] - 'a']++;
  for (long long i = 0; i < (long long)b.size(); i++) B[b[i] - 'a']++;
  for (long long i = 0; i < (long long)c.size(); i++) C[c[i] - 'a']++;
  int res = -1, op, z = -1;
  for (long long i = 0; i < (long long)a.size() + 1; i++) {
    int s = infi;
    bool bsf = 0;
    for (long long j = 0; j < (long long)26; j++) {
      int q = A[j] - B[j] * i;
      if (q < 0) {
        s = -infi;
        bsf = 1;
      }
      if (C[j] > 0) s = min(s, q / C[j]);
    }
    if (bsf) break;
    if (res + z < s + i) res = s, op = i, z = i;
  }
  string k;
  for (long long i = 0; i < (long long)res; i++) {
    for (long long j = 0; j < (long long)c.size(); j++) k.push_back(c[j]);
  }
  for (long long i = 0; i < (long long)z; i++) {
    for (long long j = 0; j < (long long)b.size(); j++) k.push_back(b[j]);
  }
  for (long long i = 0; i < (long long)k.size(); i++) A[k[i] - 'a']--;
  for (long long i = 0; i < (long long)32; i++)
    while (A[i]) {
      A[i]--;
      k.push_back((char)(i + 'a'));
    }
  cout << k;
}
