#include <bits/stdc++.h>
using namespace std;
struct q {
  int v, i;
} qq[100005];
bool operator<(const q& a, const q& b) { return a.v > b.v; }
char x[3][100005];
int cnt[3][26];
int i;
bool ok;
int aa, bb;
int main() {
  for (int a = 0; a < 3; a++) {
    scanf("%s", x[a]);
    i = 0;
    while (x[a][i] != 0) {
      cnt[a][x[a][i] - 'a']++;
      i++;
    }
  }
  i = 0;
  for (int a = 0; a < 100005; a++) {
    ok = 1;
    i = INT_MAX;
    for (int b = 0; b < 26; b++) {
      if (cnt[0][b] - cnt[1][b] * a < 0) {
        ok = 0;
        break;
      } else if (cnt[2][b] != 0)
        i = min(i, (cnt[0][b] - cnt[1][b] * a) / cnt[2][b]);
    }
    if (ok) {
      if (aa + bb < a + i) {
        aa = a;
        bb = i;
      }
    } else
      break;
  }
  for (int a = 0; a < 26; a++) {
    cnt[0][a] -= cnt[1][a] * aa + cnt[2][a] * bb;
    while (cnt[0][a]-- > 0) printf("%c", 'a' + a);
  }
  while (aa-- > 0) printf("%s", x[1]);
  while (bb-- > 0) printf("%s", x[2]);
  printf("\n");
  return 0;
}
