#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const* argv[]) {
  string a, b, c;
  cin >> a >> b >> c;
  int count[26], bcount[26], ccount[26];
  for (int i = 0; i < 26; i += 1) {
    count[i] = 0;
    bcount[i] = 0;
    ccount[i] = 0;
  }
  for (int i = 0; i < a.length(); i += 1) {
    count[a[i] - 'a']++;
  }
  int tmp[26];
  for (int i = 0; i < 26; i += 1) {
    tmp[i] = count[i];
  }
  for (int i = 0; i < b.length(); i += 1) {
    bcount[b[i] - 'a']++;
  }
  for (int i = 0; i < c.length(); i += 1) {
    ccount[c[i] - 'a']++;
  }
  int match = 0;
  int r = 0, s = 0;
  for (int i = 0;; i += 1) {
    int x = a.length();
    for (int j = 0; j < 26; j += 1) {
      if (bcount[j]) {
        x = min(x, count[j] / bcount[j]);
      }
    }
    if (x + i > match) {
      match = x + i;
      r = x;
      s = i;
    }
    bool flag = false;
    for (int j = 0; j < 26; j += 1) {
      if (count[j] < ccount[j]) {
        flag = true;
        break;
      } else {
        count[j] -= ccount[j];
      }
    }
    if (flag) {
      break;
    }
  }
  string k;
  for (int i = 0; i < r; i += 1) {
    for (int j = 0; j < b.length(); j += 1) {
      k += b[j];
    }
  }
  for (int i = 0; i < s; i += 1) {
    for (int j = 0; j < c.length(); j += 1) {
      k += c[j];
    }
  }
  for (int i = 0; i < 26; i += 1) {
    tmp[i] = tmp[i] - bcount[i] * r - ccount[i] * s;
  }
  for (int i = 0; i < 26; i += 1) {
    while (tmp[i] > 0) {
      char x = i + 'a';
      k += x;
      tmp[i]--;
    }
  }
  cout << k << endl;
  return 0;
}
