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.
a, b, c = input(), input(), input()
dct_a = dict()
dct_b = dict()
dct_c = dict()
for el in a:
    if el not in dct_a:
        dct_a[el] = 0
    dct_a[el] += 1

for el in b:
    if el not in dct_b:
        dct_b[el] = 0
    dct_b[el] += 1

for el in c:
    if el not in dct_c:
        dct_c[el] = 0
    dct_c[el] += 1

b_1 = len(b)
for el in b:
    if el not in dct_a:
        b_1 = 0
    elif el in dct_a and dct_a[el] // dct_b[el] < b_1:
        b_1 = dct_a[el] // dct_b[el]

c_1 = len(c)
for el in c:
    if el not in dct_a:
        c_1 = 0
    elif el in dct_a and (dct_a[el] - b_1 * b.count(el)) // dct_c[el] < c_1:
        c_1 = (dct_a[el] - b_1 * b.count(el)) // dct_c[el]


c_2 = len(c)
for el in c:
    if el not in dct_a:
        c_2 = 0
    elif el in dct_a and dct_a[el] // dct_c[el] < c_2:
        c_2 = dct_a[el] // dct_c[el]

b_2 = len(b)
for el in b:
    if el not in dct_a:
        b_2 = 0
    elif el in dct_a and (dct_a[el] - c_2 * c.count(el)) // dct_b[el] < b_2:
        b_2 = (dct_a[el] - c_2 * c.count(el)) // dct_b[el]


if b_1 + c_1 > b_2 + c_2:
    print(b * b_1, end='')
    print(c * c_1, end='')
    for k, v in dct_a.items():
        ans = v
        ans = ans - b_1 * b.count(k) if k in b else ans
        ans = ans - c_1 * c.count(k) if k in c else ans
        print(k * ans, end='')
else:
    print(b * b_2, end='')
    print(c * c_2, end='')
    for k, v in dct_a.items():
        ans = v
        ans = ans - b_2 * b.count(k) if k in b else ans
        ans = ans - c_2 * c.count(k) if k in c else ans
        print(k * ans, end='')
