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 re
u,v,x,y,z = [0]*26,[0]*26,[0]*26,[0]*26,[0]*26
a = input()
b = input()
c = input()
for i in a:
    u[ord(i)-97]+=1
for i in range(len(u)):
    v[i] = u[i]
    x[i] = u[i]
for i in b:
    y[ord(i)-97]+=1
for i in c:
    z[ord(i)-97]+=1

    
a1,b1,a2,a3,b2,b3 = 10005,10005,10005,10005,10005,10005
for i in b:
    if u[ord(i)-97]//y[ord(i)-97]<a1:
        a1 = u[ord(i)-97]//y[ord(i)-97]
for i in c:
    if u[ord(i)-97]//z[ord(i)-97]<b1:
        b1 = u[ord(i)-97]//z[ord(i)-97]
for i in b:
    v[ord(i)-97]-=a1
for i in c:
    x[ord(i)-97]-=b1
for i in c:
    if v[ord(i)-97]//z[ord(i)-97]<b2:
        b2 = v[ord(i)-97]//z[ord(i)-97]
for i in b:
    if x[ord(i)-97]//y[ord(i)-97]<a2:
        a2 = x[ord(i)-97]//y[ord(i)-97]

z = max(a1,b1,a1+b2,b1+a2)
if z==a1:
    for i in range(a1):
        for j in b:
            u[ord(j)-97]-=1
            print(j,end="")
    for i in range(26):
        if(u[i]>0):
            for j in range(u[i]):
                print(chr(i+97),end="")
elif z==a2:
    for i in range(b1):
        for j in c:
            u[ord(j)-97]-=1
            print(j,end="")
    for i in range(len(u)):
        if(u[i]>0):
            for j in range(u[i]):
                print(chr(i+97),end="")
elif z==a1+b2:
    for i in range(a1):
        for j in b:
            u[ord(j)-97]-=1
            print(j,end="")
    for i in range(b2):
        for j in c:
            u[ord(j)-97]-=1
            print(j,end="")
    for i in range(len(u)):
        if(u[i]>0):
            for j in range(u[i]):
                print(chr(i+97),end="")
elif z==b1+a2:
    for i in range(b1):
        for j in c:
            u[ord(j)-97]-=1
            print(j,end="")
    for i in range(a2):
        for j in b:
            u[ord(j)-97]-=1
            print(j,end="")
    for i in range(len(u)):
        if(u[i]>0):
            for j in range(u[i]):
                print(chr(i+97),end="")
