#include <bits/stdc++.h>
using namespace std;
long long dx[] = {1, 0, -1, 0};
long long dy[] = {0, 1, 0, -1};
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long expo(long long n, long long m, long long p) {
  long long r = 1;
  n = n % p;
  while (m > 0) {
    if (m % 2) r = (r * n) % p;
    n = (n * n) % p;
    m = m / 2;
  }
  return r % p;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  string a, b, c;
  cin >> a >> b >> c;
  long long ca[26] = {0}, cb[26] = {0}, cc[26] = {0};
  long long mb = (1LL << 61);
  for (long long i = 0; i < a.size(); i++) {
    ca[a[i] - 'a']++;
  }
  for (long long i = 0; i < b.size(); i++) {
    cb[b[i] - 'a']++;
  }
  for (long long i = 0; i < c.size(); i++) {
    cc[c[i] - 'a']++;
  }
  for (long long i = 0; i < 26; i++) {
    if (cb[i] == 0)
      ;
    else
      mb = min(mb, ca[i] / cb[i]);
  }
  long long a1 = 0, a2 = 0;
  for (long long i = 0; i <= mb; i++) {
    long long ta1 = i, ta2 = (1LL << 61);
    long long A[26];
    for (long long j = 0; j < 26; j++) {
      A[j] = ca[j];
      A[j] -= i * cb[j];
    }
    for (long long j = 0; j < 26; j++) {
      if (cc[j] == 0)
        ;
      else if (cc[j] != 0)
        ta2 = min(ta2, A[j] / cc[j]);
    }
    if (a1 + a2 < ta1 + ta2) {
      a1 = ta1, a2 = ta2;
    }
  }
  string ans;
  for (long long i = 0; i < a1; i++) {
    for (long long j = 0; j < b.size(); j++) {
      ans.push_back(b[j]);
      ca[b[j] - 'a']--;
    }
  }
  for (long long i = 0; i < a2; i++) {
    for (long long j = 0; j < c.size(); j++) {
      ans.push_back(c[j]);
      ca[c[j] - 'a']--;
    }
  }
  for (long long i = 0; i < 26; i++) {
    for (long long j = 0; j < ca[i]; j++) {
      ans.push_back('a' + i);
    }
  }
  cout << ans << '\n';
}
