#include <bits/stdc++.h>
int main(void) {
  char str[3][100001] = {{0}};
  int str_count[3][26] = {{0}};
  int num_b_max = 0, num_c_max = 0, num_sum_max = 0, same = 0;
  {
    int i, j, str_i_len;
    for (i = 0; i < 3; i++) {
      scanf("%s", str[i]);
      str_i_len = strlen(str[i]);
      for (j = 0; j < str_i_len; j++) str_count[i][str[i][j] - 'a']++;
    }
  }
  {
    int num_b, num_c, b_out, c_out, i, j;
    if (strcmp(str[1], str[2]) == 0) same = 1;
    for (num_b = 0, b_out = 0; !b_out; num_b++) {
      for (i = 0; i < 26; i++)
        if (str_count[0][i] < str_count[1][i] * num_b) b_out = 1;
      for (num_c = num_sum_max - num_b, c_out = 0; !b_out && !c_out && !same;
           num_c++) {
        for (j = 0; j < 26; j++)
          if (str_count[0][j] <
              str_count[1][j] * num_b + str_count[2][j] * num_c)
            c_out = 1;
        if (!c_out)
          num_b_max = num_b, num_c_max = num_c, num_sum_max = num_b + num_c;
      }
      if (same && !b_out) num_b_max = num_b;
    }
  }
  {
    int i, j, k, l, num;
    for (i = 0; i < num_b_max; i++) printf("%s", str[1]);
    for (j = 0; j < num_c_max; j++) printf("%s", str[2]);
    for (k = 0; k < 26; k++) {
      num = str_count[0][k] - str_count[1][k] * num_b_max -
            str_count[2][k] * num_c_max;
      for (l = 0; l < num; l++) printf("%c", k + 'a');
    }
  }
  return 0;
}
