#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 4;
int a1[27], a2[27], a3[27];
int main() {
  ios::sync_with_stdio(0);
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  for (int i = 0; i < s1.size(); i++) {
    a1[s1[i] - 'a']++;
  }
  for (int i = 0; i < s2.size(); i++) {
    a2[s2[i] - 'a']++;
  }
  for (int i = 0; i < s3.size(); i++) {
    a3[s3[i] - 'a']++;
  }
  int k1 = 0, k2 = 0, sum = 0;
  for (int i = 0; i <= 100001; i++) {
    int k = 0;
    for (int j = 0; j < 26; j++) {
      if (a1[j] - a2[j] * i < 0) {
        k = 1;
        break;
      }
    }
    int kk;
    if (k == 0) {
      kk = 100002;
      for (int j = 0; j < 26; j++) {
        if (a3[j] != 0) kk = min(kk, (a1[j] - a2[j] * i) / a3[j]);
      }
      if (i + kk > sum) {
        sum = i + kk;
        k1 = i;
        k2 = kk;
      }
    } else
      break;
  }
  for (int i = 0; i < k1; i++) cout << s2;
  for (int i = 0; i < k2; i++) cout << s3;
  for (int i = 0; i < 26; i++) a1[i] = a1[i] - a2[i] * k1 - a3[i] * k2;
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < a1[i]; j++) {
      char x = 'a' + i;
      cout << x;
    }
  return 0;
}
