#include <bits/stdc++.h>
using namespace std;
const int alpha = 26;
int main() {
  string a, b, c;
  cin >> a;
  cin >> b;
  cin >> c;
  int aa[alpha] = {0}, bb[alpha] = {0}, cc[alpha] = {0};
  for (int i = 0; i < a.size(); i++) aa[a[i] - 'a']++;
  for (int i = 0; i < b.size(); i++) bb[b[i] - 'a']++;
  for (int i = 0; i < c.size(); i++) cc[c[i] - 'a']++;
  int k = 1000000000;
  for (int i = 0; i < alpha; i++)
    if (bb[i] != 0) k = min(k, aa[i] / bb[i]);
  int maxb = 0, maxc = 0;
  for (int i = k; i >= 0; i--) {
    int l = 1000000000;
    for (int j = 0; j < alpha; j++)
      if (cc[j] != 0) l = min(l, (aa[j] - bb[j] * i) / cc[j]);
    if (i + l > maxb + maxc) {
      maxb = i;
      maxc = l;
    }
  }
  for (int i = 0; i < maxb; i++) cout << b;
  for (int i = 0; i < maxc; i++) cout << c;
  for (int i = 0; i < alpha; i++) {
    aa[i] -= maxb * bb[i] + maxc * cc[i];
    for (int j = 0; j < aa[i]; j++) cout << char(i + 'a');
  }
}
