#include <bits/stdc++.h>
using namespace std;
int s[26];
int s1[26];
int s2[26];
const int maxn = 100100;
char ss[maxn], ss1[maxn], ss2[maxn];
void getnum(int s[], char* s3) {
  int l = strlen(s3);
  for (int i = 0; i < l; i++) s[s3[i] - 'a']++;
}
int main() {
  cin >> ss >> ss1 >> ss2;
  getnum(s, ss);
  getnum(s1, ss1);
  getnum(s2, ss2);
  int n1 = maxn, n2 = maxn;
  for (int i = 0; i < 26; i++) {
    if (s[i] == 0 && s1[i]) {
      n1 = 0;
      break;
    }
    if (s[i] && s1[i] && s[i] / s1[i] < n1) n1 = s[i] / s1[i];
  }
  int ans1 = n1, ans2 = 0;
  for (int i = 0; i <= n1; i++) {
    n2 = maxn;
    for (int j = 0; j < 26; j++) {
      int t = s[j] - i * s1[j];
      if (s2[j] && t / s2[j] < n2) {
        n2 = t / s2[j];
      }
    }
    if (n2 + i > ans1 + ans2) {
      ans1 = i;
      ans2 = n2;
    }
  }
  for (int i = 0; i < ans1; i++) cout << ss1;
  for (int i = 0; i < ans2; i++) cout << ss2;
  for (int i = 0; i < 26; i++) {
    int n = s[i] - ans1 * s1[i] - ans2 * s2[i];
    char p = i + 'a';
    for (int j = 0; j < n; j++) {
      cout << p;
    }
  }
  cout << endl;
  return 0;
}
