#include <bits/stdc++.h>
using namespace std;
char a[100005], b[100005], c[100005];
long letters[27][3];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(letters, 0, sizeof(letters));
  cin >> a >> b >> c;
  long int lena = strlen(a), lenb = strlen(b), lenc = strlen(c);
  for (long i = 0; i < lena; i++) letters[a[i] - 'a'][0]++;
  for (long i = 0; i < lenb; i++) letters[b[i] - 'a'][1]++;
  for (long i = 0; i < lenc; i++) letters[c[i] - 'a'][2]++;
  long int ans = -1;
  long int ansb = 0, ansc = 0;
  long int mini = lena / lenc;
  for (long int i = 0; i <= mini; i++) {
    long minb = 999999;
    bool posi = true;
    for (int j = 0; j < 26; j++) {
      long ava = letters[j][0] - i * letters[j][2];
      if (ava < letters[j][1]) minb = 0;
      if (ava < 0) posi = false;
      if (letters[j][1] != 0) minb = min(minb, ava / letters[j][1]);
    }
    if (!posi) continue;
    if (minb + i > ans) {
      ans = minb + i;
      ansb = minb;
      ansc = i;
    }
  }
  for (long int i = 0; i < ansb; i++) {
    cout << b;
  }
  for (long int i = 0; i < ansc; i++) cout << c;
  for (int j = 0; j < 26; j++) {
    letters[j][0] -= (ansb * letters[j][1] + ansc * letters[j][2]);
    for (long int i = 1; i <= letters[j][0]; i++) cout << (char)('a' + j);
  }
  cout << endl;
  return 0;
}
