#include <bits/stdc++.h>
void quit();
using namespace std;
const long double PI = acos((double)-1.0);
const long double EPS = 1e-11;
double __t;
string s1, s2, s3;
long long k1[30], k2[30], k3[30];
long long ans, t, a1, a2;
long long cnt() {
  long long mmax = 999999;
  for (int i = 0; i < (int)26; ++i)
    if (k3[i] > 0) mmax = min(mmax, k1[i] / k3[i]);
  return mmax;
}
int main() {
  cin >> s1 >> s2 >> s3;
  for (int i = 0; i < (int)s1.size(); ++i) k1[s1[i] - 'a']++;
  for (int i = 0; i < (int)s2.size(); ++i) k2[s2[i] - 'a']++;
  for (int i = 0; i < (int)s3.size(); ++i) k3[s3[i] - 'a']++;
  for (int i = 0; i < (int)100001; ++i) {
    bool can = 1;
    for (int j = 0; j < (int)26; ++j) k1[j] -= i * k2[j];
    for (int j = 0; j < (int)26; ++j)
      if (k1[j] < 0) can = 0;
    if (can) {
      t = cnt();
      if (i + t > ans) {
        ans = i + t;
        a1 = i;
        a2 = t;
      }
    }
    for (int j = 0; j < (int)26; ++j) k1[j] += i * k2[j];
  }
  for (int i = 0; i < (int)26; ++i) {
    k1[i] -= k2[i] * a1;
    k1[i] -= k3[i] * a2;
  }
  for (int i = 0; i < (int)a1; ++i) cout << s2;
  for (int i = 0; i < (int)a2; ++i) cout << s3;
  for (int i = 0; i < (int)26; ++i)
    for (int j = 0; j < (int)k1[i]; ++j) cout << (char)(i + 'a');
  quit();
}
void quit() { exit(0); }
