#include <bits/stdc++.h>
using namespace std;
string a, b, c;
int arr[26];
int sub1[26];
int sub2[26];
void makestr(string &ans, string s, int num) {
  for (int i = 0; i < num; i++) ans += s;
  for (int i = 0; i < s.size(); i++) arr[s[i] - 'a'] -= num;
}
int main() {
  cin >> a >> b >> c;
  for (int i = 0; i < a.size(); i++) arr[a[i] - 'a']++;
  for (int i = 0; i < b.size(); i++) sub1[b[i] - 'a']++;
  for (int i = 0; i < c.size(); i++) sub2[c[i] - 'a']++;
  int mx1 = 1000000000;
  for (int i = 0; i < 26; i++) {
    if (sub1[i]) mx1 = min(mx1, arr[i] / sub1[i]);
  }
  int f = 0;
  int s = 0;
  for (int i = 0; i <= mx1; i++) {
    int num = i;
    int m = 1000000000;
    for (int j = 0; j < 26; j++)
      if (sub2[j]) m = min(m, (arr[j] - i * sub1[j]) / sub2[j]);
    m = max(0, m);
    num += m;
    if (num > f + s) f = i, s = m;
  }
  string ans = "";
  makestr(ans, b, f);
  makestr(ans, c, s);
  for (int i = 0; i < 26; i++)
    if (arr[i])
      for (int j = 0; j < arr[i]; j++) ans += char(i + 'a');
  cout << ans << endl;
}
