#include <bits/stdc++.h>
using namespace std;
int charA[27], charB[27], charC[27];
void decByC() {
  for (int j = 0; j < 27; j++) charA[j] -= charC[j];
}
void decByB() {
  for (int j = 0; j < 27; j++) charA[j] -= charB[j];
}
int findCountC() {
  int tempCountC = 1000007;
  for (int j = 0; j < 27; j++) {
    if (charC[j] != 0) {
      if (charA[j] / charC[j] < tempCountC) tempCountC = charA[j] / charC[j];
    }
  }
  return tempCountC;
}
int findCountB() {
  int tempCountB = 1000007;
  for (int j = 0; j < 27; j++) {
    if (charB[j] != 0) {
      if (charA[j] / charB[j] < tempCountB) tempCountB = charA[j] / charB[j];
    }
  }
  return tempCountB;
}
void restartC(int countC) {
  for (int i = 0; i < 27; i++) charA[i] += charC[i] * countC;
}
void restartB(int countB) {
  for (int i = 0; i < 27; i++) charA[i] += charB[i] * countB;
}
int main() {
  string a, b, c;
  cin >> a >> b >> c;
  for (int i = 0; i < a.length(); i++) charA[a[i] - 'a']++;
  for (int i = 0; i < b.length(); i++) charB[b[i] - 'a']++;
  for (int i = 0; i < c.length(); i++) charC[c[i] - 'a']++;
  int maxAns = 0, maxCountB = 0, maxCountC = 0;
  int countB = findCountB();
  for (int i = 1; i <= countB; i++) {
    decByB();
    int tempCountC = findCountC();
    if (maxAns < tempCountC + i) {
      maxAns = tempCountC + i;
      maxCountC = tempCountC;
      maxCountB = i;
    }
  }
  restartB(countB);
  int countC = findCountC();
  for (int i = 1; i <= countC; i++) {
    decByC();
    int tempCountB = findCountB();
    if (maxAns < tempCountB + i) {
      maxAns = tempCountB + i;
      maxCountB = tempCountB;
      maxCountC = i;
    }
  }
  restartC(countC);
  for (int i = 0; i < maxCountB; i++) cout << b;
  for (int i = 0; i < maxCountC; i++) cout << c;
  for (int i = 0; i < 27; i++)
    charA[i] -= (charB[i] * maxCountB + charC[i] * maxCountC);
  for (int i = 0; i < 27; i++) {
    while (charA[i]) {
      cout << (char)(i + 'a');
      charA[i]--;
    }
  }
  return 0;
}
