#include <bits/stdc++.h>
int x[26], y[26], z[26];
int main() {
  int i, j, na = 0, nb = 0, nc = 0, maxb, maxc, c1, c2, total = 0;
  char a[100001], b[100001], c[100001];
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", c);
  for (i = 0; a[i] != '\0'; i++) {
    x[a[i] - 'a']++;
    na++;
  }
  for (i = 0; b[i] != '\0'; i++) {
    y[b[i] - 'a']++;
    nb++;
  }
  for (i = 0; c[i] != '\0'; i++) {
    z[c[i] - 'a']++;
    nc++;
  }
  maxb = 1000000;
  for (i = 0; i < 26; i++) {
    if (y[i] != 0) maxb = maxb < (x[i] / y[i]) ? maxb : (x[i] / y[i]);
  }
  for (i = 0; i <= maxb; i++) {
    maxc = 1000000;
    for (j = 0; j < 26; j++) {
      if (z[j] != 0)
        maxc = (maxc < ((x[j] - i * y[j]) / z[j])) ? maxc
                                                   : ((x[j] - i * y[j]) / z[j]);
    }
    if (i + maxc > total) {
      total = i + maxc;
      c1 = i;
      c2 = maxc;
    }
  }
  for (i = 1; i <= c1; i++) {
    printf("%s", b);
    for (j = 0; j < nb; j++) x[b[j] - 'a']--;
  }
  for (i = 1; i <= c2; i++) {
    printf("%s", c);
    for (j = 0; j < nc; j++) x[c[j] - 'a']--;
  }
  for (i = 0; i < 26; i++) {
    while (x[i]) {
      putchar('a' + i);
      x[i]--;
    }
  }
  printf("\n");
  return 0;
}
