#include <bits/stdc++.h>
using namespace std;
void _551A() {
  int n;
  cin >> n;
  int* array = new int[n];
  int* count_arr = new int[2001];
  for (int i = 0; i < 2001; i++) {
    count_arr[i] = 0;
  }
  int tmp;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    array[i] = tmp;
    count_arr[tmp]++;
  }
  int cnt = 1;
  tmp = 1;
  int prev = 1;
  for (int i = 2001; i >= 0; i--) {
    if (count_arr[i] == 0) continue;
    tmp = count_arr[i];
    cnt = prev + cnt - 1;
    count_arr[i] = cnt;
    prev = tmp;
    cnt++;
  }
  for (int i = 0; i < n; i++) {
    cout << count_arr[array[i]] << " ";
  }
}
void print_bucket(int* bucket) {
  for (int i = 0; i < 26; i++) cout << char(i + 'a') << ":" << bucket[i] << " ";
  cout << endl;
}
bool has_enough_letters(int* bucket, int* sub) {
  int bucket_copy[26];
  for (int i = 0; i < 26; i++) bucket_copy[i] = bucket[i];
  for (int i = 0; i < 26; i++) {
    if ((bucket_copy[i] -= sub[i]) < 0) {
      return false;
    }
  }
  return true;
}
int runA(string& final_string, string& a, string& b, string& c) {
  int bucket[26];
  int bucket_b[26];
  int bucket_c[26];
  int bucket_c_a[26];
  for (int i = 0; i < 26; i++) {
    bucket[i] = 0;
    bucket_b[i] = 0;
    bucket_c[i] = 0;
  }
  for (int i = 0; i < a.size(); i++) {
    bucket[a[i] - 'a']++;
  }
  for (int i = 0; i < b.size(); i++) {
    bucket_b[b[i] - 'a']++;
  }
  for (int i = 0; i < c.size(); i++) {
    bucket_c[c[i] - 'a']++;
  }
  int total = 0;
  int max_c = 0;
  int max_b = 0;
  for (int i = 0;; i++) {
    if (has_enough_letters(bucket, bucket_b) or i == 0) {
      for (int j = 0; j < 26 and i != 0; j++) {
        bucket[j] -= bucket_b[j];
      }
      int local_max_c = 0;
      for (int k = 0; k < 26; k++) bucket_c_a[k] = bucket[k];
      for (local_max_c = 0; has_enough_letters(bucket_c_a, bucket_c);) {
        for (int j = 0; j < 26; j++) bucket_c_a[j] -= bucket_c[j];
        local_max_c++;
      }
      if (local_max_c + i >= max_c + max_b) {
        max_b = i;
        max_c = local_max_c;
      }
    } else
      break;
  }
  for (int i = 0; i < 26; i++) {
    bucket[i] = 0;
  }
  for (int i = 0; i < a.size(); i++) {
    bucket[a[i] - 'a']++;
  }
  for (int i = 0; i < b.size(); i++) {
    bucket[b[i] - 'a'] -= max_b;
  }
  for (int i = 0; i < c.size(); i++) {
    bucket[c[i] - 'a'] -= max_c;
  }
  for (int i = 0; i < max_b; i++) {
    cout << b;
  }
  for (int i = 0; i < max_c; i++) {
    cout << c;
  }
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < bucket[i]; j++) cout << char('a' + i);
  cout << endl;
}
bool enough_letters(int* bucket, int* bucket_sub, int size) {
  for (int i = 0; i < 26; i++)
    if (bucket[i] - (bucket_sub[i] * size) < 0) return false;
  return true;
}
void _551B() {
  string a, b, c;
  cin >> a >> b >> c;
  string final_string_a = "", final_string_b;
  int bucket[26];
  int bucket_b[26];
  int bucket_c[26];
  for (int i = 0; i < 26; i++) {
    bucket[i] = 0;
    bucket_b[i] = 0;
    bucket_c[i] = 0;
  }
  for (int i = 0; i < a.size(); i++) {
    bucket[a[i] - 'a']++;
  }
  for (int i = 0; i < b.size(); i++) {
    bucket_b[b[i] - 'a']++;
  }
  for (int i = 0; i < c.size(); i++) {
    bucket_c[c[i] - 'a']++;
  }
  int x, y;
  int max = -5, max_x = -1, max_y = -1;
  bool test;
  for (x = 0;; x++) {
    if (!enough_letters(bucket, bucket_b, x) and x != 0) {
      break;
    }
    int local_max_c = 2000000000;
    for (int i = 0; i < 26; i++) {
      if (bucket_c[i] &&
          (bucket[i] - bucket_b[i] * x) / bucket_c[i] < local_max_c) {
        local_max_c = (bucket[i] - bucket_b[i] * x) / bucket_c[i];
      }
    }
    if (local_max_c + x > max) {
      max = local_max_c + x;
      max_x = x;
      max_y = local_max_c;
    }
  }
  string final;
  for (int i = 0; i < max_x; i++) {
    final.append(b);
  }
  for (int i = 0; i < max_y; i++) {
    final.append(c);
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j < bucket[i] - bucket_b[i] * max_x - bucket_c[i] * max_y;
         j++)
      final.push_back('a' + i);
  }
  cout << final << endl;
}
void _552A() {
  int n;
  cin >> n;
  int cnt = 0;
  int x1, x2, y1, y2;
  for (int i = 0; i < n; i++) {
    cin >> x1 >> y1 >> x2 >> y2;
    int x, y;
    x = x2 - x1 + 1;
    y = y2 - y1 + 1;
    cnt += x * y;
  }
  cout << cnt;
}
int pow(int x, int e) {
  if (e == 0) return 1;
  int acc = x;
  for (int i = 0; i < e - 1; i++) {
    acc *= x;
  }
  return acc;
}
void _552B() {
  long long cnt = 0;
  long long n;
  cin >> n;
  if (n < 10) {
    cout << n << endl;
    return;
  }
  if (n == 1000000000) {
    cout << 8888888899 << endl;
    return;
  }
  for (long long i = 1; i <= 9; i++) {
    if (pow(10, i) <= n) {
      long long c = pow(10, i) * i * 0.9;
      cnt += c;
    } else {
      long long c = ((n - pow(10, i - 1)) + 1) * i;
      cnt += c;
      break;
    }
  }
  cout << cnt << endl;
}
int main(int argc, char** argv) {
  _551B();
  return 0;
}
