#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:64000000")
const int infi = 1e9 + 7;
const long long infl = 1e18 + 7;
int cnt[3][30];
int tmp[30];
string s[3];
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < (3); ++i) {
    cin >> s[i];
    for (int j = 0; j < ((int)s[i].size()); ++j) ++cnt[i][s[i][j] - 'a'];
  }
  pair<int, int> ans = make_pair(0, 0);
  for (int q = 0; q < (100500); ++q) {
    int flag = 1;
    int mn = infi;
    for (int i = 0; i < (30); ++i) {
      if (cnt[1][i] * q > cnt[0][i]) {
        flag = 0;
      }
      if (cnt[2][i]) {
        mn = min(mn, (cnt[0][i] - cnt[1][i] * q) / cnt[2][i]);
      }
    }
    if (!flag) break;
    if (ans.first + ans.second < q + mn) {
      ans.first = q, ans.second = mn;
    }
  }
  int mn1 = ans.first, mn2 = ans.second;
  for (int i = 0; i < (mn1); ++i) cout << s[1];
  for (int i = 0; i < (mn2); ++i) cout << s[2];
  for (int i = 0; i < (30); ++i) {
    cnt[0][i] -= cnt[1][i] * mn1 + cnt[2][i] * mn2;
    for (int j = 0; j < (cnt[0][i]); ++j) cout << (char)('a' + i);
  }
  return 0;
}
