#include <bits/stdc++.h>
using namespace std;
void solve() {
  string a, b, c;
  cin >> a >> b >> c;
  vector<long long> cnt1(26), cnt2(26), cnt3(26);
  for (auto& it : a) cnt1[it - 'a']++;
  for (auto& it : b) cnt2[it - 'a']++;
  for (auto& it : c) cnt3[it - 'a']++;
  long long max_occur_b = 2e9;
  for (long long i = 0; i < 26; i++) {
    if (cnt2[i] > 0) {
      long long take = cnt1[i] / cnt2[i];
      max_occur_b = min(max_occur_b, take);
    }
  }
  long long count_b = 0, count_c = 0;
  for (long long occur_b = 0; occur_b <= max_occur_b; occur_b++) {
    long long occur_c = max_occur_b - occur_b;
    long long max_poss = 2e9;
    for (long long i = 0; i < 26; i++) {
      if (cnt3[i] > 0) {
        long long remain = cnt1[i] - occur_b * cnt2[i];
        assert(remain >= 0);
        max_poss = min(max_poss, remain / cnt3[i]);
      }
    }
    if (occur_b + max_poss > count_b + count_c) {
      count_b = occur_b, count_c = max_poss;
    }
  }
  for (long long i = 0; i < count_b; i++) {
    cout << b;
  }
  for (long long i = 0; i < count_c; i++) {
    cout << c;
  }
  for (long long i = 0; i < 26; i++) {
    long long remain = cnt1[i] - (count_b * cnt2[i] + count_c * cnt3[i]);
    assert(remain >= 0);
    while (remain--) cout << (char)(i + 'a');
  }
  cout << '\n';
}
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
