#include <bits/stdc++.h>
using namespace std;
char a[100010];
char b[100010];
char c[100010];
int main() {
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", c);
  int fa[26] = {0}, fb[26] = {0}, fc[26] = {0};
  int la = strlen(a);
  int lb = strlen(b);
  int lc = strlen(c);
  for (int i = 0; i < la; i++) fa[a[i] - 'a']++;
  for (int i = 0; i < lb; i++) fb[b[i] - 'a']++;
  for (int i = 0; i < lc; i++) fc[c[i] - 'a']++;
  int maxb = -1;
  for (int i = 0; i < 26; i++) {
    if (fb[i] && (maxb == -1 || maxb > fa[i] / fb[i])) maxb = fa[i] / fb[i];
  }
  int max = -1;
  int muchb = 0, muchc = 0;
  for (int i = 0; i < maxb + 1; i++) {
    int maxc = -1;
    for (int j = 0; j < 26; j++) {
      if (fc[j] && (maxc == -1 || maxc > (fa[j] - i * fb[j]) / fc[j]))
        maxc = (fa[j] - i * fb[j]) / fc[j];
    }
    if (max == -1 || max < maxc + i) {
      max = maxc + i;
      muchb = i;
      muchc = maxc;
    }
  }
  for (int i = 0; i < muchb; i++) printf("%s", b);
  for (int i = 0; i < muchc; i++) printf("%s", c);
  for (int i = 0; i < 26; i++) {
    int r = fa[i] - muchb * fb[i] - muchc * fc[i];
    while (r--) printf("%c", i + 'a');
  }
  printf("\n");
}
