#include <bits/stdc++.h>
char a[100000 + 10];
char b[100000 + 10];
char c[100000 + 10];
int _hash[200];
int _hash2[200];
int _hash3[200];
int numb, numc;
int main() {
  while (scanf("%s%s%s", a, b, c) != EOF) {
    memset(_hash, 0, sizeof(_hash));
    memset(_hash2, 0, sizeof(_hash2));
    memset(_hash3, 0, sizeof(_hash3));
    int len = strlen(a);
    int len2 = strlen(b);
    int len3 = strlen(c);
    for (int i = 0; i < len; i++) {
      _hash[a[i]]++;
    }
    for (int i = 0; i < len2; i++) {
      _hash2[b[i]]++;
    }
    for (int i = 0; i < len3; i++) {
      _hash3[c[i]]++;
    }
    numb = 1000000;
    int maxnumb;
    int maxsum = -1000;
    int maxnum;
    for (int i = 0; i < 200; i++) {
      if (_hash2[i] != 0)
        if (_hash[i] / _hash2[i] < numb) numb = _hash[i] / _hash2[i];
    }
    for (int i = 0; i <= numb; i++) {
      for (int j = 0; j < 200; j++) {
        if (_hash2[j] != 0) _hash[j] -= i * _hash2[j];
      }
      maxnum = 1000000;
      for (int j = 0; j < 200; j++) {
        if (_hash3[j] != 0)
          if (_hash[j] / _hash3[j] < maxnum) maxnum = _hash[j] / _hash3[j];
      }
      for (int j = 0; j < 200; j++) {
        if (_hash2[j] != 0) _hash[j] += i * _hash2[j];
      }
      if (i + maxnum > maxsum) {
        maxnumb = i;
        numc = maxnum;
        maxsum = i + maxnum;
      }
    }
    for (int i = 0; i < maxnumb; i++) printf("%s", b);
    for (int i = 0; i < numc; i++) printf("%s", c);
    for (int i = 0; i < 200; i++) {
      if (_hash2[i] != 0) _hash[i] -= maxnumb * _hash2[i];
      if (_hash3[i] != 0) _hash[i] -= numc * _hash3[i];
    }
    for (int i = 0; i < 200; i++) {
      if (_hash[i] != 0)
        for (int j = 0; j < _hash[i]; j++) printf("%c", (char)i);
    }
    printf("\n");
  }
  return 0;
}
