#include <bits/stdc++.h>
using namespace std;
string a, b, c, k;
int d[26], p[26], q[26];
int times_b, times_c;
inline void fill_ini() {
  for (int i = 0; i < a.size(); i++) {
    d[a[i] - 'a']++;
  }
  for (int i = 0; i < b.size(); i++) {
    p[b[i] - 'a']++;
  }
  for (int i = 0; i < c.size(); i++) {
    q[c[i] - 'a']++;
  }
}
inline int tb() {
  int minn = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (p[i] == 0) continue;
    minn = min(minn, d[i] / p[i]);
  }
  return minn;
}
inline int tc() {
  int minn = INT_MAX;
  for (int i = 0; i < 26; i++) {
    if (q[i] == 0) continue;
    minn = min(minn, d[i] / q[i]);
  }
  return minn;
}
inline void erase_b(int times) {
  for (int i = 0; i < 26; i++) {
    d[i] -= (p[i] * times);
  }
}
inline void erase_c(int times) {
  for (int i = 0; i < 26; i++) {
    d[i] -= (q[i] * times);
  }
}
inline void printer_b(int times) {
  for (int i = 0; i < times; i++) {
    cout << b;
  }
}
inline void printer_c(int times) {
  for (int i = 0; i < times; i++) {
    cout << c;
  }
}
inline void printer() {
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < d[i]; j++) {
      cout << (char)(i + 'a');
    }
  }
  cout << '\n';
}
inline void solver() {
  fill_ini();
  times_b = tb();
  times_c = tc();
  while (true) {
    if (times_b <= 0 && times_c <= 0) break;
    if (times_b >= times_c && times_b > 0) {
      cout << b;
      erase_b(1);
      times_b = tb();
      times_c = tc();
    } else if (times_c > 0) {
      cout << c;
      erase_c(1);
      times_c = tc();
      times_b = tb();
    }
  }
  printer();
}
inline void start() {
  cin >> a >> b >> c;
  memset(d, 0, sizeof(d));
  memset(q, 0, sizeof(q));
  memset(p, 0, sizeof(p));
  solver();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  start();
  return 0;
}
