#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  int c1[26] = {}, c2[26] = {}, c3[26] = {};
  for (int i = 0; i < a.size(); i++) c1[a[i] - 'a']++;
  for (int i = 0; i < b.size(); i++) c2[b[i] - 'a']++;
  for (int i = 0; i < c.size(); i++) c3[c[i] - 'a']++;
  string result;
  while (1) {
    int MIN2 = 123456789, MIN3 = 123456789;
    for (int i = 0; i < 26; i++) {
      if (c2[i]) MIN2 = min(MIN2, c1[i] / c2[i]);
      if (c3[i]) MIN3 = min(MIN3, c1[i] / c3[i]);
    }
    if (!MIN2 && !MIN3) break;
    if (MIN2 >= MIN3) {
      result += b;
      for (int i = 0; i < 26; i++) c1[i] -= c2[i];
    } else {
      result += c;
      for (int i = 0; i < 26; i++) c1[i] -= c3[i];
    }
  }
  for (int i = 0; i < 26; i++) {
    char tmp = 'a' + i;
    for (int w = 0; w < c1[i]; w++) result += tmp;
  }
  cout << result;
}
