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 get_profile(s):
    p = [0] * 26
    for c in s:
        p[ord(c) - ord('a')] += 1
    return p

def get_ans_one_str(a, b):
    return min(has // need for (has, need) in zip(a, b) if need > 0)

def get_ans_two_strs(a, b, c):
    left = list(a)
    b_count = 0
    res = None
    while True:
        c_count = get_ans_one_str(left, c)
        cur_res = (b_count + c_count, b_count, c_count)
        #print c_count, b_count
        if res is None or cur_res > res:
            res = cur_res

        for i, b_x in enumerate(b):
            left[i] -= b_x
        
        if min(left) < 0:
            break

        b_count += 1

    return res

    
def solve(a_s, b_s, c_s):
    a, b, c = map(get_profile, (a_s, b_s, c_s))
    ans, b_cnt, c_cnt = get_ans_two_strs(a, b, c)
    for i, b_x in enumerate(b):
        a[i] -= b_x * b_cnt

    for i, c_x in enumerate(c):
        a[i] -= c_x * c_cnt

    #print c_cnt, b_cnt
    return ''.join([b_s] * b_cnt + [c_s] * c_cnt + [chr(ord('a') + i) * c for (i, c) in enumerate(a)])

print(solve(*[input().strip() for i in range(3)]))
        
