#include <bits/stdc++.h>
using namespace std;
double pi = 3.141592653589793238462;
string numkey = "0123456789";
string uni = "abcdefghijklmnopqrstuvwxyz";
long long int dx[4] = {0, 0, 1, -1};
long long int dy[4] = {1, -1, 0, 0};
long long int INF = (1LL << 62);
long long int calc(vector<long long int> &c1, vector<long long int> c2) {
  long long int mn = INF;
  for (long long int i = 0; i < 26; i++) {
    if (c1[i] == -1 && c2[i] != -1) {
      return 0;
    }
    if (c1[i] != -1 && c2[i] != -1) {
      mn = min(mn, c1[i] / c2[i]);
    }
  }
  for (long long int i = 0; i < 26; i++) {
    if (c2[i] != -1) c1[i] -= mn * c2[i];
  }
  return mn;
}
signed main() {
  string a, b, c;
  cin >> a >> b >> c;
  vector<long long int> cnt1(26), cnt2(26), cnt3(26);
  for (long long int i = 0; i < a.length(); i++) {
    cnt1[a[i] - 'a']++;
  }
  for (long long int i = 0; i < b.length(); i++) {
    cnt2[b[i] - 'a']++;
  }
  for (long long int i = 0; i < c.length(); i++) {
    cnt3[c[i] - 'a']++;
  }
  vector<long long int> c1 = cnt1, c2 = cnt2, c3 = cnt3;
  long long int val = INF;
  for (long long int i = 0; i < 26; i++) {
    if (cnt2[i]) val = min(val, cnt1[i] / cnt2[i]);
  }
  long long int ans1 = 0, ans2 = 0;
  for (long long int i = 0; i <= val; i++) {
    long long int forb = 1000000;
    for (long long int j = 0; j < 26; j++) {
      if (cnt3[j]) forb = min(forb, (cnt1[j] - i * cnt2[j]) / cnt3[j]);
    }
    if (i + forb > ans1 + ans2) ans1 = i, ans2 = forb;
  }
  for (long long int i = 0; i < ans1; i++) {
    cout << b;
  }
  for (long long int j = 0; j < ans2; j++) cout << c;
  for (long long int i = 0; i < 26; i++) {
    cnt1[i] -= (cnt2[i] * ans1 + cnt3[i] * ans2);
    while (cnt1[i] > 0) {
      cnt1[i]--;
      cout << uni[i];
    }
  }
  return 0;
}
