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=input()
b=input()
c=input()
l1=[0 for x in range(26)]
l2=[0 for x in range(26)]
l3=[0 for x in range(26)]
for i in range(len(a)):
    l1[ord(a[i])-97]+=1
for i in range(len(b)):
    l2[ord(b[i])-97]+=1
for i in range(len(c)):
    l3[ord(c[i])-97]+=1

sf=""
f1=0
f2=0
k=0
lf=len(a)
while(k<lf):
    df1=100000
    df2=100000
    d1=0
    d2=0
    for i in range(26):
        if(l2[i]>0):
            d1=l1[i]-l2[i]
            df1=min(d1,df1)
        if(l3[i]>0):
            d2=l1[i]-l3[i]
            df2=min(d2,df2)
        if d1<0:
            f1=1
        if d2<0:
            f2=1
    
    if(f1==1 and f2==1):
        while(k<lf):
            for m in range(26):
                if(l1[m]>0):
                    sf=sf+chr(m+97)
                    k+=1
                    l1[m]-=1
    elif(df1>df2 and f1!=1):
        sf+=b
        for m in range(26):
            l1[m]=l1[m]-l2[m]
        k+=len(b)
    else:
        sf+=c
        for m in range(26):
            l1[m]=l1[m]-l3[m]
        k+=len(c)
print(sf)
