#include <bits/stdc++.h>
using namespace std;
string a, b, c, ansStr;
int cnt[26], nc[26], nb[26], aa = 987654321, bb = 98764321, ans, x, y;
int main() {
  ios::sync_with_stdio(false);
  cin >> a >> b >> c;
  for (int i = 0; i < a.size(); i++) cnt[a[i] - 'a']++;
  for (int i = 0; i < b.size(); i++) nb[b[i] - 'a']++;
  for (int i = 0; i < c.size(); i++) nc[c[i] - 'a']++;
  for (int i = 0; i < 26; i++)
    if (nb[i]) aa = min(aa, cnt[i] / nb[i]);
  for (int i = 0; i <= aa; i++) {
    for (int j = 0; j < 26; j++)
      if (nb[j]) cnt[j] -= nb[j] * i;
    int k = 987654321;
    for (int j = 0; j < 26; j++) {
      if (nc[j]) k = min(k, cnt[j] / nc[j]);
    }
    if (ans < (i + k)) ans = i + k, x = i, y = k;
    for (int j = 0; j < 26; j++)
      if (nb[j]) cnt[j] += nb[j] * i;
  }
  for (int i = 0; i < x; i++) ansStr += b;
  for (int i = 0; i < y; i++) ansStr += c;
  for (int j = 0; j < 26; j++)
    if (nb[j]) cnt[j] -= nb[j] * x;
  for (int i = 0; i < 26; i++)
    if (nc[i]) cnt[i] -= nc[i] * y;
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < cnt[i]; j++) ansStr += (char)(i + 'a');
  cout << ansStr << endl;
}
