#include <bits/stdc++.h>
std::string a, b, c, ans("");
int cntA[30], cntB[30], cntC[30];
int CountMax(int arrA[30], int arrB[30]) {
  int cnt = 100000 + 10;
  for (int i = 0; i < 26; ++i) {
    if (arrB[i] != 0) {
      if (arrA[i] != 0)
        cnt = std::min(cnt, arrA[i] / arrB[i]);
      else {
        cnt = 0;
        break;
      }
    }
  }
  return cnt;
}
void Increase(int arrA[30], int arrB[30], int cnt) {
  for (int i = 0; i < 26; ++i) arrA[i] += (cnt * arrB[i]);
}
void Decrease(int arrA[30], int arrB[30], int cnt) {
  for (int i = 0; i < 26; ++i) arrA[i] -= (cnt * arrB[i]);
}
int main() {
  std::cin >> a >> b >> c;
  int len = a.length();
  for (int i = 0; i < len; ++i) ++cntA[a[i] - 'a'];
  len = b.length();
  for (int i = 0; i < len; ++i) ++cntB[b[i] - 'a'];
  len = c.length();
  for (int i = 0; i < len; ++i) ++cntC[c[i] - 'a'];
  int maxB = CountMax(cntA, cntB);
  int cntMax = 0, iMax = 0, tmp;
  for (int i = 0; i <= maxB; ++i) {
    Decrease(cntA, cntB, i);
    tmp = i + CountMax(cntA, cntC);
    if (tmp > cntMax) cntMax = tmp, iMax = i;
    Increase(cntA, cntB, i);
  }
  for (int i = 1; i <= iMax; ++i) ans += b;
  Decrease(cntA, cntB, iMax);
  iMax = CountMax(cntA, cntC);
  for (int i = 1; i <= iMax; ++i) ans += c;
  Decrease(cntA, cntC, iMax);
  for (int i = 0; i < 26; ++i)
    if (cntA[i] != 0) ans += std::string(cntA[i], char('a' + i));
  std::cout << ans;
}
