#include <bits/stdc++.h>
using namespace std;
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  int freq[3][26] = {};
  for (int i = 0; i < a.length(); i++) freq[0][a[i] - 'a']++;
  for (int i = 0; i < b.length(); i++) freq[1][b[i] - 'a']++;
  for (int i = 0; i < c.length(); i++) freq[2][c[i] - 'a']++;
  int ans = 0, f = 0, s = 0;
  for (int t = 0; t < 100001; t++) {
    bool can = true;
    for (int j = 0; j < 26; j++) {
      if (freq[1][j] > 0) {
        can = can && (long long)t * freq[1][j] <= freq[0][j];
      }
    }
    if (!can) break;
    long long mn = 1e6;
    for (int j = 0; j < 26; j++) {
      if (freq[2][j] > 0) {
        mn = min(mn, (freq[0][j] - (long long)t * freq[1][j]) / freq[2][j]);
      }
    }
    if (ans < mn + t) {
      ans = mn + t;
      f = t;
      s = mn;
    }
  }
  string res = "";
  for (int j = 0; j < 26; j++) {
    freq[0][j] -= f * freq[1][j];
    freq[0][j] -= s * freq[2][j];
  }
  for (int i = 0; i < f; i++) {
    res += b;
  }
  for (int i = 0; i < s; i++) {
    res += c;
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < freq[0][i]; j++) {
      res += ('a' + i);
    }
  }
  cout << res << endl;
}
