#include <bits/stdc++.h>
using namespace std;
double const EPS = 2.22045e-016;
void print_v(vector<int> arr) {
  int n = ((int)((arr).size()));
  for (int i = 0; i < (int)(n); ++i)
    if (i == n - 1)
      printf("%d\n", arr[i]);
    else
      printf("%d ", arr[i]);
}
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  vector<int> a_h(30, 0), b_h(30, 0), c_h(30, 0);
  for (int i = 0; i < (int)(((int)((a).size()))); ++i) a_h[a[i] - 'a']++;
  for (int i = 0; i < (int)(((int)((b).size()))); ++i) b_h[b[i] - 'a']++;
  for (int i = 0; i < (int)(((int)((c).size()))); ++i) c_h[c[i] - 'a']++;
  int const MAX = 100005;
  int ans1, ans2 = 0;
  for (int t = 0; t < (int)(MAX); ++t) {
    vector<int> a_temp(a_h);
    bool g = true;
    for (int i = 0; i < (int)(30); ++i) {
      if (b_h[i] * t > a_temp[i]) {
        g = false;
        break;
      }
      a_temp[i] -= b_h[i] * t;
    }
    if (!g) break;
    g = true;
    int mn = MAX;
    for (int i = 0; i < (int)(30); ++i) {
      if (c_h[i] > a_temp[i]) {
        g = false;
        break;
      }
      if (c_h[i] != 0) mn = min(mn, a_temp[i] / c_h[i]);
    }
    if (mn == MAX || !g) mn = 0;
    if (ans2 + ans1 < t + mn) {
      ans1 = t;
      ans2 = mn;
    }
  }
  for (int i = 0; i < (int)(30); ++i) {
    a_h[i] -= (b_h[i] * ans1 + c_h[i] * ans2);
  }
  for (int i = 0; i < (int)(ans1); ++i) cout << b;
  for (int i = 0; i < (int)(ans2); ++i) cout << c;
  for (int i = 0; i < (int)(30); ++i) {
    for (int k = 0; k < (int)(a_h[i]); ++k) printf("%c", i + 'a');
  }
  printf("\n");
  return 0;
}
