#include <bits/stdc++.h>
using namespace std;
char a[100010], b[100010], c[100010];
int cnt_a[26], cnt_b[26], cnt_c[26];
int remain[26], len_a, len_b, len_c;
int c_num, max_b, max_c;
void subtract(int b_num) {
  if (b_num * len_b > len_a) return;
  for (int i = 0; i < 26; i++) {
    remain[i] = cnt_a[i] - b_num * cnt_b[i];
    if (remain[i] < 0) return;
  }
  int c_num = 200000;
  for (int i = 0; i < 26; i++)
    if (cnt_c[i] != 0)
      if (remain[i] / cnt_c[i] < c_num) c_num = remain[i] / cnt_c[i];
  if (c_num != 200000 && b_num + c_num > max_b + max_c)
    max_b = b_num, max_c = c_num;
  subtract(b_num + 1);
}
int main() {
  while (fgets(a, sizeof(a), stdin) != NULL) {
    fgets(b, sizeof(b), stdin);
    fgets(c, sizeof(c), stdin);
    memset(cnt_a, 0, sizeof(cnt_a));
    memset(cnt_b, 0, sizeof(cnt_b));
    memset(cnt_c, 0, sizeof(cnt_c));
    len_a = strlen(a), len_b = strlen(b), len_c = strlen(c);
    a[len_a - 1] = 0, b[len_b - 1] = 0, c[len_c - 1] = 0;
    len_a--, len_b--, len_c--;
    for (int i = 0; i < len_a; i++) cnt_a[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']++;
    max_b = 0, max_c = 0;
    subtract(0);
    for (int i = 1; i <= max_b; i++) printf("%s", b);
    for (int i = 1; i <= max_c; i++) printf("%s", c);
    for (int i = 0; i < 26; i++) {
      for (int j = 1; j <= cnt_a[i] - max_b * cnt_b[i] - max_c * cnt_c[i]; j++)
        printf("%c", i + 'a');
    }
    printf("\n");
  }
  return 0;
}
