#include <bits/stdc++.h>
using namespace std;
long long a[200005], b[200005], f[100005], dp[100005];
int main() {
  string a, b, c;
  long long p, cnt[26] = {0}, cnt1[26] = {0}, cnt2[26] = {0}, i, j, k, l, m, n;
  cin >> a >> b >> c;
  for (i = 0; i < a.size(); i++) cnt[a[i] - 'a']++;
  for (i = 0; i < b.size(); i++) cnt1[b[i] - 'a']++;
  for (i = 0; i < c.size(); i++) cnt2[c[i] - 'a']++;
  k = 1e9 + 7;
  l = 1e9 + 7;
  for (i = 0; i < 26; i++)
    if (cnt1[i] != 0) k = min(k, cnt[i] / cnt1[i]);
  for (i = 0; i < 26; i++)
    if (cnt2[i] != 0) l = min(l, cnt[i] / cnt2[i]);
  long long ans = 0;
  long long o = 0;
  for (i = 0; i <= k; i++) {
    l = 1e9 + 7;
    for (j = 0; j < 26; j++) {
      if (cnt2[j] > 0) l = min(l, (cnt[j] - i * cnt1[j]) / cnt2[j]);
    }
    if ((l + i) > ans) ans = l + i, o = i;
  }
  for (i = 1; i <= o; i++) cout << b;
  for (i = 0; i < ans - o; i++) cout << c;
  for (i = 0; i < 26; i++) {
    p = cnt[i] - o * cnt1[i] - (ans - o) * cnt2[i];
    if (p > 0) {
      for (j = 0; j < p; j++) cout << char('a' + i);
    }
  }
}
