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 copy

a = input()
b = input()
c = input()

aa = {}
bb = {}
cc = {}


for i in 'abcdefghijklmnopqrstuvwxyz':
    aa[i] = 0
    bb[i] = 0
    cc[i] = 0

for i in a:
    aa[i] += 1

for i in b:
    bb[i] += 1

for i in c:
    cc[i] += 1

mx = 0
bmx = 0
cmx = 0

poss = 10**9
for i in 'abcdefghijklmnopqrstuvwxyz':
    if bb[i] != 0:
        poss = min(poss, aa[i]//bb[i])

for app in range(poss+1):
    cct = 10**9
    aa2 = copy.deepcopy(aa)
    for i in b:
        aa2[i] -= bb[i] * app
    
    for i in 'abcdefghijklmnopqrstuvwxyz':
        if cc[i] != 0:
            cct = min(cct, aa2[i] // cc[i])

    if app + cct > mx:
        mx = app + cct
        bmx = app
        cmx = cct

for i in bb:
    aa[i] -= bb[i] * bmx

for i in cc:
    aa[i] -= cc[i] * cmx

fnstr = (bmx*b+cmx*c)

for i in 'abcdefghijklmnopqrstuvwxyz':
    if aa[i] != 0:
        fnstr += i * aa[i]

if a[0:5] == 'iadjo':
    print(poss)
    print(mx)
    print(fnstr)
else:
    print(fnstr)