#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200001;
long long arr[MAXN];
string s[3];
long long cnt[3][26];
void calc(long long idx, string &s) {
  for (long long i = 0; i < s.length(); i++) {
    cnt[idx][s[i] - 'a']++;
  }
}
bool isCan(long long mid) {
  for (long long j = 0; j < 26; j++) {
    if (cnt[0][j] - cnt[2][j] * mid < 0) return false;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> s[0] >> s[1] >> s[2];
  calc(0, s[0]), calc(1, s[1]), calc(2, s[2]);
  long long ans = 0;
  long long L = 0, R = 0;
  for (long long i = 0; i <= s[0].length(); i++) {
    long long low = 0, high = s[0].length();
    for (long long j = 0; j < 26; j++) {
      if (cnt[0][j] < 0) break;
    }
    while (low <= high) {
      long long mid = (low + high) / 2;
      if (isCan(mid)) {
        low = mid + 1;
        if (mid + i > ans) {
          ans = mid + i;
          L = i, R = mid;
        }
      } else
        high = mid - 1;
    }
    for (long long j = 0; j < 26; j++) {
      cnt[0][j] -= cnt[1][j];
    }
  }
  for (long long i = 0; i < 26; i++) cnt[0][i] = 0;
  calc(0, s[0]);
  string ret;
  for (long long i = 0; i < L; i++) {
    cout << s[1];
    for (long long j = 0; j < 26; j++) cnt[0][j] -= cnt[1][j];
  }
  for (long long i = 0; i < R; i++) {
    cout << s[2];
    for (long long j = 0; j < 26; j++) cnt[0][j] -= cnt[2][j];
  }
  cout << ret;
  for (long long i = 0; i < 26; i++) {
    for (long long j = 0; j < cnt[0][i]; j++) {
      cout << char('a' + i);
    }
  }
  return 0;
}
