#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:200000000")
int cntA[26], cntB[26], cntC[26];
int scnt[26];
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  for (int i = 0, maxi = (int)(a).size(); i < maxi; i++) {
    cntA[(a[i] - 'a')]++;
    scnt[(a[i] - 'a')]++;
  }
  for (int i = 0, maxi = (int)(b).size(); i < maxi; i++) {
    cntB[(b[i] - 'a')]++;
  }
  for (int i = 0, maxi = (int)(c).size(); i < maxi; i++) {
    cntC[(c[i] - 'a')]++;
  }
  int bestres = 0;
  int bestcnt = 0;
  for (int i = 0, maxi = (int)(a).size() / (int)(b).size(); i <= maxi; i++) {
    for (int j = 0; j < 26; j++) cntA[j] = scnt[j];
    bool stop = false;
    for (int j = 0; j < 26; j++) {
      if (cntA[j] < cntB[j] * i) {
        stop = true;
        break;
      }
    }
    if (stop) break;
    int ost = 1e9;
    for (int j = 0; j < 26; j++) {
      int cur = cntA[j] - cntB[j] * i;
      if (cntC[j] != 0) ost = min(ost, cur / cntC[j]);
    }
    if (ost + i > bestcnt) bestcnt = ost + i, bestres = i;
  }
  string res = "";
  for (int i = 0; i < bestres; i++) {
    res += b;
  }
  int ost = 1e9;
  for (int j = 0; j < 26; j++) {
    int cur = cntA[j] - cntB[j] * bestres;
    if (cntC[j] != 0) ost = min(ost, cur / cntC[j]);
  }
  for (int j = 0; j < 26; j++) {
    cntA[j] -= cntB[j] * bestres;
  }
  for (int i = 0; i < ost; i++) {
    res += c;
  }
  for (int j = 0; j < 26; j++) {
    cntA[j] -= cntC[j] * ost;
  }
  for (int j = 0; j < 26; j++) {
    for (int i = 0; i < cntA[j]; i++) {
      res += (j + 'a');
    }
  }
  cout << res << endl;
  return 0;
}
