Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one.

GukiZ has strings *a*, *b*, and *c*. He wants to obtain string *k* by swapping some letters in *a*, so that *k* should contain as many non-overlapping substrings equal either to *b* or *c* as possible. Substring of string *x* is a string formed by consecutive segment of characters from *x*. Two substrings of string *x* overlap if there is position *i* in string *x* occupied by both of them.

GukiZ was disappointed because none of his students managed to solve the problem. Can you help them and find one of possible strings *k*?
The first line contains string *a*, the second line contains string *b*, and the third line contains string *c* (1 ≤ |*a*|, |*b*|, |*c*| ≤ 10<sup class="upper-index">5</sup>, where |*s*| denotes the length of string *s*).

All three strings consist only of lowercase English letters. 

It is possible that *b* and *c* coincide.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 missingdays <missingdays@missingdays>
#
# Distributed under terms of the MIT license.

"""

"""
import string

def calc(s):
    a = [0 for i in range(26)]
    for c in s:
        a[string.ascii_lowercase.index(c)] += 1
    return a

def diff(a, b):
    c = [0 for i in range(26)]
    for i in range(len(a)):
        if b[i] != 0:
            if a[i] != 0:
                c[i] = a[i] // b [i]
            else:
                return 0
    m = 100001
    for i in range(len(c)):
        if c[i]!=0 and c[i]<m:
            m = c[i]
    if m == 100001:
        return 0
    return m

def sub_arr(a, b):
    for i in range(len(a)):
        a[i] -= b[i]
    return a

a = input()
b = input()
c = input()

a_a = calc(a)
b_a = calc(b)
c_a = calc(c)

b_diff = diff(a_a,b_a)
c_diff = diff(a_a,c_a)

f_string = []

if b_diff > c_diff:
    for i in range(b_diff):
        f_string.append(b)
        a_a = sub_arr(a_a, b_a)
    for i in range(len(a_a)):
        f_string.append(string.ascii_lowercase[i]*a_a[i])
else:
    for i in range(c_diff):
        f_string.append(c)
        a_a = sub_arr(a_a, c_a) 
    for i in range(len(a_a)):
        f_string.append(string.ascii_lowercase[i]*a_a[i])
print(''.join(f_string))
