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.
contest = True
if not contest:
    fin = open("in", "r")
inp = input if contest else lambda: fin.readline()[:-1]
read = lambda: tuple(map(int, inp().split()))

cstr = lambda s: dict([[v, s.count(v)] for v in set(s)])

a, b, c = inp(), inp(), inp()
ka, kb, kc = cstr(a), cstr(b), cstr(c)

sb, sc = len(b), len(c)

if len(b) > len(c):
    b, c = c, b
    kb, kc = kc, kb
ans = ""
d = 10**10
for k in kb:
    if not k in ka:
        d = 0
        break
    d = min(ka[k] // kb[k], d)
for k in kb:
    if k in ka:
        ka[k] -= d * kb[k]
#print(d, ka, b * d)
ans += b * d

d = 10**10
for k in kc:
    if not k in ka:
        d = 0
        break
    d = min(ka[k] // kc[k], d)
for k in kc:
    if k in ka:
        ka[k] -= d * kc[k]
#print(d, ka, c * d)
ans += c * d

for k in ka:
    ans += ka[k] * k
print(ans)

