#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
const int maxp = 30;
char a[maxn], b[maxn], c[maxn];
int cnt_a[maxp], cnt_b[maxp], cnt_c[maxp], cnt_d[maxn];
int ans = 0;
int main() {
  scanf("%s", a);
  scanf("%s", b);
  scanf("%s", c);
  int len_a = strlen(a);
  int len_b = strlen(b);
  int len_c = strlen(c);
  for (int i = 0; i < len_a; i++) {
    cnt_a[a[i] - 'a']++;
    cnt_d[a[i] - 'a']++;
  }
  for (int i = 0; i < len_b; i++) {
    cnt_b[b[i] - 'a']++;
  }
  for (int i = 0; i < len_c; i++) {
    cnt_c[c[i] - 'a']++;
  }
  int max_b = 10000000, max_c = 10000000;
  ans = 0;
  for (int i = 0; i < 26; i++) {
    if (cnt_b[i]) max_b = min(max_b, cnt_a[i] / cnt_b[i]);
    if (cnt_c[i]) max_c = min(max_c, cnt_a[i] / cnt_c[i]);
  }
  int ans_i = -1, ans_j = -1;
  for (int i = 0; i <= max_b; i++) {
    int cnt = 1000000;
    for (int j = 0; j < 26; j++) {
      cnt_d[j] = cnt_a[j] - i * cnt_b[j];
    }
    for (int j = 0; j < 26; j++) {
      if (cnt_c[j]) cnt = min(cnt, cnt_d[j] / cnt_c[j]);
    }
    if (cnt + i > ans) {
      ans_i = i;
      ans_j = cnt;
      ans = cnt + i;
    }
  }
  if (ans_i == -1 || ans_j == -1) {
    printf("%s\n", a);
  } else {
    for (int i = 0; i < 26; i++) {
      cnt_a[i] -= cnt_b[i] * ans_i;
      cnt_a[i] -= cnt_c[i] * ans_j;
    }
    for (int i = 1; i <= ans_i; i++) {
      printf("%s", b);
    }
    for (int j = 1; j <= ans_j; j++) {
      printf("%s", c);
    }
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < cnt_a[i]; j++) {
        printf("%c", 'a' + i);
      }
    }
    printf("\n");
  }
  return 0;
}
