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.
def CofW(s1, s2):
    d = dict()
    s = set()
    for i in range(len(s2)):
        if s2[i] in s:
            d[s2[i]] += 1
        else:
            s.add(s2[i])
            d[s2[i]] = 1
    count = 0;
    i = s2[0]
    for j in range(len(s1)):
        if ord(s1[j]) > ord(i):
            break
        if s1[j] == i:
            count += 1 
    min = count
    s = set()
    for i in range(len(s2)):
        count = 0
        for j in range(len(s1)):
            if ord(s1[j]) > ord(s2[i]):
                break
            if s1[j] == s2[i]:
                count += 1
        if s2[i] not in s:
            count //= d[s2[i]]
        else:
            s.add(s2[i])
        if count < min:
            min = count
    return min


def delete(s1, s2, count1):
    news = ''
    s = set()
    for i in s2:
        s.add(i)
    set1 = set()
    i = 0
    while i < len(s1):
        if s1[i] not in s:
            news += s1[i]
            i += 1
        else:
            if s1[i] not in set1:
                set1.add(s1[i])
                i += count1
                continue
            else:
                news += s1[i]
                i += 1
    return news

s = input()
s1 = input()
s2 = input()
help1 = ''
help2 = ''
for i in s1:
    help1 += i
for i in s2:
    help2 += i
m = []
for i in s:
    m.append(ord(i))
m.sort()        
m1 = []
for i in s1:
    m1.append(ord(i))
m1.sort()
m2 = []
for i in s2:
    m2.append(ord(i))
m2.sort()
for i in range(len(m)):
    m[i] = chr(m[i])
for i in range(len(m2)):
    m2[i] = chr(m2[i])
for i in range(len(m1)):
    m1[i] = chr(m1[i])
s = ''
for i in m:
    s += i
s1 = ''
for i in m1:
    s1 += i
s2 = ''
for i in m2:
    s2 += i
CofW1 = CofW(s, s1)
CofW2 = CofW(s, s2)
if CofW(s, s1) >= CofW(s, s2):
    s = delete(s, s1, CofW(s, s1))
    ans = help1 * CofW1
    CofW2 = CofW(s, s2)
    s = delete(s, s2, CofW2)
    ans += help2 * CofW2
    ans += s
    print(ans)
else:
    s = delete(s, s2, CofW(s, s2))
    ans = help2 * CofW2
    CofW1 = CofW(s, s1)
    s = delete(s, s1, CofW1)
    ans += help1 * CofW1
    ans += s
    print(ans)
    
