#include <bits/stdc++.h>
using namespace std;
char a[100005], b[100005], c[100005];
vector<char> arr1, arr2, val;
map<char, int> mp1, mp2, mp3;
int main() {
  cin >> a;
  cin >> b;
  cin >> c;
  int len2 = strlen(b);
  for (int i = 0; i < len2; i++) {
    if (mp1.count(b[i]) == 0) {
      arr1.push_back(b[i]);
      mp1[b[i]] = 1;
    } else {
      mp1[b[i]]++;
    }
  }
  int len3 = strlen(c);
  for (int i = 0; i < len3; i++) {
    if (mp2.count(c[i]) == 0) {
      arr2.push_back(c[i]);
      mp2[c[i]] = 1;
    } else {
      mp2[c[i]]++;
    }
  }
  int len1 = strlen(a);
  for (int i = 0; i < len1; i++) {
    if (mp3.count(a[i]) == 0) {
      val.push_back(a[i]);
      mp3[a[i]] = 1;
    } else {
      mp3[a[i]]++;
    }
  }
  int temp1 = 123123;
  for (int i = 0; i < arr1.size(); i++) {
    int calc = mp3[arr1[i]] / mp1[arr1[i]];
    temp1 = min(temp1, calc);
  }
  int temp2 = 123123;
  for (int i = 0; i < arr2.size(); i++) {
    int calc = mp3[arr2[i]] / mp2[arr2[i]];
    temp2 = min(calc, temp2);
  }
  int sum = -123123;
  int bc = 0, mc = 0;
  for (int i = 0; i <= temp1; i++) {
    for (int j = 0; j < arr1.size(); j++) {
      mp3[arr1[j]] -= (i * mp1[arr1[j]]);
    }
    int temp3 = 123123;
    for (int j = 0; j < arr2.size(); j++) {
      int calc = mp3[arr2[j]] / mp2[arr2[j]];
      temp3 = min(calc, temp3);
    }
    for (int j = 0; j < arr1.size(); j++) {
      mp3[arr1[j]] += (i * mp1[arr1[j]]);
    }
    if (i + temp3 > sum) {
      bc = i;
      mc = temp3;
      sum = max(sum, i + temp3);
    }
  }
  for (int i = 0; i < bc; i++) {
    printf("%s", b);
  }
  for (int i = 0; i < mc; i++) {
    printf("%s", c);
  }
  for (int i = 0; i < arr1.size(); i++) {
    mp3[arr1[i]] -= (bc * mp1[arr1[i]]);
  }
  for (int i = 0; i < arr2.size(); i++) {
    mp3[arr2[i]] -= (mc * mp2[arr2[i]]);
  }
  for (int i = 0; i < val.size(); i++) {
    for (int j = 0; j < mp3[val[i]]; j++) {
      printf("%c", val[i]);
    }
  }
  return 0;
}
