#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int inf = 0x3f3f3f3f;
char a[N], b[N], c[N];
int len1, len2, len3;
int cnt1[26], cnt2[26], cnt3[26], ans[26];
bool work(int x[], int y[], int w, int &ans1, int &ans2) {
  int num[26];
  for (int i = 0; i < 26; i++) num[i] = cnt1[i];
  int res = inf;
  for (int i = 0; i < 26; i++)
    if (x[i] * w > num[i]) return false;
  for (int i = 0; i < 26; i++) num[i] -= w * x[i];
  for (int i = 0; i < 26; i++)
    if (y[i]) res = min(res, num[i] / y[i]);
  for (int i = 0; i < 26; i++) num[i] -= res * y[i];
  if (w + res > ans1 + ans2) {
    ans1 = w;
    ans2 = res;
    for (int i = 0; i < 26; i++) ans[i] = num[i];
  }
  return true;
}
int main() {
  scanf("%s%s%s", a, b, c);
  len1 = strlen(a);
  len2 = strlen(b);
  len3 = strlen(c);
  for (int i = 0; i < len1; i++) cnt1[a[i] - 'a']++;
  for (int i = 0; i < len2; i++) cnt2[b[i] - 'a']++;
  for (int i = 0; i < len3; i++) cnt3[c[i] - 'a']++;
  for (int i = 0; i < 26; i++) ans[i] = cnt1[i];
  int ans1 = 0, ans2 = 0;
  for (int i = 0; i <= len1; i++) {
    if (!work(cnt2, cnt3, i, ans1, ans2)) break;
  }
  for (int i = 1; i <= ans1; i++) printf("%s", b);
  for (int i = 1; i <= ans2; i++) printf("%s", c);
  for (int i = 0; i < 26; i++)
    for (int j = 1; j <= ans[i]; j++) printf("%c", 'a' + i);
  puts("");
  return 0;
}
