#include <bits/stdc++.h>
using namespace std;
long long a[26], b[26], c[26], c1, c2;
int main() {
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  for (int i = 0; i < s1.size(); i++) {
    a[s1[i] - 'a']++;
  }
  for (int i = 0; i < s2.size(); i++) {
    b[s2[i] - 'a']++;
  }
  for (int i = 0; i < s3.size(); i++) {
    c[s3[i] - 'a']++;
  }
  while (1) {
    long long m = 1e9, m1 = 1e9;
    for (int i = 0; i < 26; i++) {
      if (b[i]) {
        m = min(m, a[i] / b[i]);
      }
      if (c[i]) {
        m1 = min(m1, a[i] / c[i]);
      }
    }
    if (m == 0 && m1 == 0) {
      break;
    }
    if (m > m1) {
      c1++;
      for (int i = 0; i < 26; i++) {
        a[i] -= b[i];
      }
    } else {
      c2++;
      for (int i = 0; i < 26; i++) {
        a[i] -= c[i];
      }
    }
  }
  while (c1--) {
    cout << s2;
  }
  while (c2--) {
    cout << s3;
  }
  for (int i = 0; i < 26; i++) {
    while (a[i]--) {
      cout << (char)(i + 'a');
    }
  }
  return 0;
}
