#include <bits/stdc++.h>
using namespace std;
const double PI = 2.0 * acos(0.0);
const double EPS = 1e-9;
int cases = 1;
double getdist(pair<int, int> a, pair<int, int> b) {
  return sqrt(pow((double)a.first - b.first, 2) +
              pow((double)a.second - b.second, 2));
}
void Read() { return; }
const int MAX = 100000 + 5;
int bb[30], cc[30], aa[30], lenA, lenB, lenC, q[26];
char a[MAX], b[MAX], c[MAX];
int finA, finB;
void solve() {
  lenA = strlen(a);
  lenB = strlen(b);
  lenC = strlen(c);
  for (int i = 0; i < lenB; i++) bb[b[i] - 'a']++;
  for (int i = 0; i < lenC; i++) cc[c[i] - 'a']++;
  for (int i = 0; i < lenA; i++) aa[a[i] - 'a']++;
  int cnt = 0, cnt_ = 0;
  bool flag = true;
  while (true) {
    for (int i = 0; i < 26; i++) q[i] = aa[i];
    for (int i = 0; i < 26; i++) {
      if (bb[i] > 0) {
        if (q[i] < bb[i] * cnt) {
          flag = false;
          break;
        }
        q[i] -= bb[i] * cnt;
      }
    }
    if (flag == false) break;
    cnt_ = 1000000000;
    for (int i = 0; i < 26; i++) {
      if (cc[i] > 0) {
        cnt_ = min(cnt_, q[i] / cc[i]);
      }
    }
    if (cnt + cnt_ > finA + finB) {
      finA = cnt;
      finB = cnt_;
    }
    cnt++;
  }
  return;
}
int main() {
  int test;
  scanf("%s %s %s", a, b, c);
  solve();
  for (int i = 0; i < finA; ++i) {
    printf("%s", b);
    for (int j = 0; j < 26; ++j) aa[j] -= bb[j];
  }
  for (int i = 0; i < finB; ++i) {
    printf("%s", c);
    for (int j = 0; j < 26; ++j) aa[j] -= cc[j];
  }
  for (int i = 0; i < 26; ++i) {
    while (aa[i] > 0) printf("%c", i + 'a'), aa[i]--;
  }
  printf("\n");
  return 0;
}
