#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, x, y, T, ans, big, cas, num, len;
bool flag;
char a[100015], b[100015], c[100015];
int pa[30], pb[30], pc[30];
int main() {
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", c);
  int lena = strlen(a);
  for (i = 0; i < lena; i++) {
    pa[a[i] - 'a']++;
  }
  int lenb = strlen(b);
  for (i = 0; i < lenb; i++) {
    pb[b[i] - 'a']++;
  }
  int lenc = strlen(c);
  for (i = 0; i < lenc; i++) {
    pc[c[i] - 'a']++;
  }
  int mib = 0x3fffffff;
  for (i = 0; i < 26; i++) {
    if (pb[i] == 0) continue;
    mib = min(mib, pa[i] / pb[i]);
  }
  ans = 0;
  int ansi = 0, ansj = 0;
  for (i = 0; i <= mib; i++) {
    int mic = 0x3fffffff;
    for (j = 0; j < 26; j++) {
      if (pc[j] == 0) continue;
      mic = min(mic, (pa[j] - pb[j] * i) / pc[j]);
    }
    if (ansi + ansj < i + mic) {
      ansi = i;
      ansj = mic;
    }
  }
  for (i = 0; i < ansi; i++) printf("%s", b);
  for (i = 0; i < ansj; i++) printf("%s", c);
  for (i = 0; i < 26; i++) {
    int t = pa[i] - ansi * pb[i] - ansj * pc[i];
    for (j = 0; j < t; j++) printf("%c", i + 'a');
  }
  printf("\n");
  return 0;
}
