#include <bits/stdc++.h>
char a[100005];
char b[100005];
char c[100005];
int AA[30];
int A[30];
int B[30];
int C[30];
int main(void) {
  int i, j;
  int lenA, lenB, lenC;
  int cntB, cntC, max, mB, mC;
  bool chk;
  scanf("%s%s%s", a, b, c);
  lenA = strlen(a);
  lenB = strlen(b);
  lenC = strlen(c);
  for (i = 0; i < lenA; i++) A[a[i] - 'a']++;
  for (i = 0; i < lenB; i++) B[b[i] - 'a']++;
  for (i = 0; i < lenC; i++) C[c[i] - 'a']++;
  for (i = 0; i < 26; i++) AA[i] = A[i];
  cntB = cntC = max = 0;
  while (1) {
    chk = true;
    for (i = 0; i < 26; i++) {
      if (A[i] < B[i]) chk = false;
    }
    if (!chk) break;
    for (i = 0; i < 26; i++) A[i] -= B[i];
    cntB++;
  }
  max = cntB;
  mB = cntB;
  mC = 0;
  while (1) {
    while (1) {
      chk = true;
      for (i = 0; i < 26; i++) {
        if (A[i] < C[i]) chk = false;
      }
      if (!chk) break;
      for (i = 0; i < 26; i++) A[i] -= C[i];
      cntC++;
    }
    if (max < cntB + cntC) {
      max = cntB + cntC;
      mB = cntB;
      mC = cntC;
    }
    if (cntB == 0) break;
    for (i = 0; i < 26; i++) A[i] += B[i];
    cntB--;
  }
  for (i = 0; i < mB; i++) printf("%s", b);
  for (i = 0; i < mC; i++) printf("%s", c);
  for (i = 0; i < 26; i++) {
    AA[i] -= B[i] * mB;
    AA[i] -= C[i] * mC;
    for (j = 0; j < AA[i]; j++) printf("%c", i + 'a');
  }
  printf("\n");
  return 0;
}
