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 operator

def count(string, substring):
    n_counts = len(string)
    for i in range(len(string)):
        if substring[i] > 0 and n_counts > string[i]//substring[i]:
            n_counts = string[i]//substring[i]
    return n_counts


def word2frec(word):
    v = [0] * (ord('z')-ord('a')+1)
    for char in word:
        v[ord(char)-ord('a')] += 1
    return v


def frec2word(vector):
    out = ''
    for i in range(len(vector)):
        out += chr(i+ord('a')) * vector[i]
    return out


def list_sub(list_a, list_b):
    l = [0]*len(list_a)
    for i in range(len(list_a)):
        l[i] = list_a[i] - list_b[i]
    return l


def list_mul(list_a, factor):
    return [factor*x for x in list_a]


if __name__ == "__main__":
    a = input()
    v_a = word2frec(a)
    b = input()
    v_b = word2frec(b)
    c = input()
    v_c = word2frec(c)

    n_ab = count(v_a, v_b)
    best_n = 0
    best_string = a
    for n in range(n_ab+1):
        aux = a
        n_ac = count(list_sub(v_a, list_mul(v_b, n_ab)), v_c)
        if n + n_ac > best_n:
            best_n = n + n_ac
            best_string = b*n + c*n_ac + frec2word(list_sub(list_sub(v_a, list_mul(v_b, n)), list_mul(v_c, n_ac)))
    print(best_string)
