#include <bits/stdc++.h>
using namespace std;
int a[30], b[30], c[30];
string s, s1, s2;
int i, j;
int main() {
  cin >> s >> s1 >> s2;
  for (auto ch : s) a[ch - 'a']++;
  for (auto ch : s1) b[ch - 'a']++;
  for (auto ch : s2) c[ch - 'a']++;
  int m = 0x3f3f3f3f, n = 0x3f3f3f3f, bb = 0, cc = 0;
  for (i = 0; i <= 26; i++)
    if (b[i] != 0) m = min(m, a[i] / b[i]);
  for (i = 0; i <= m; i++) {
    for (j = 0; j <= 26; j++)
      if (c[j] != 0) n = min(n, (a[j] - i * b[j]) / c[j]);
    if (i + n > bb + cc) bb = i, cc = n;
  }
  for (i = 1; i <= bb; i++) cout << s1;
  for (i = 1; i <= cc; i++) cout << s2;
  for (i = 0; i <= 26; i++)
    if (a[i] - bb * b[i] - cc * c[i] > 0) cout << char('a' + i), a[i]--, i--;
}
