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.
import string
from collections import defaultdict
INF = 2147483647

string_a = input()
string_b = input()
string_c = input()

dict_a = defaultdict(int)
dict_b = defaultdict(int)
dict_c = defaultdict(int)

for ch in string_a:
    dict_a[ch] += 1
for ch in string_b:
    dict_b[ch] += 1
for ch in string_c:
    dict_c[ch] += 1

bn, cn = 0, 0
for i in range(100001):
    j = INF
    for ch in string.ascii_lowercase:
        a, b, c = dict_a[ch], dict_b[ch], dict_c[ch]
        a -= b*i
        if a < 0:
            j = -1
        if c != 0:
            j = min(j, int(a/c) )
    if j == -1:
        break
    if i+j > bn+cn:
        (bn, cn) = (i, j)

res = ""
for i in range(bn):
    res += string_b
for i in range(cn):
    res += string_c

for ch in string.ascii_lowercase:
    a, b, c = dict_a[ch], dict_b[ch], dict_c[ch]
    a -= b*bn + c*cn
    res += ch*a

print(res)

