import itertools, copy



n = input().split()



ans = 0

for p0, p1 in itertools.permutations(n, 2):

    n_ = copy.copy(n)

    n_.remove(p0)

    n_.remove(p1)

    

    total = int(''.join([p0, p1])) + int(n_[0])

    ans = max(ans, total)



print(ans)
n = list(map(int, input().split()))



nmax = max(n)

n.remove(nmax)

ans = nmax * 10 + sum(n) 

print(ans)
import itertools, copy

n = input().split()
ans = 0
for p0, p1 in itertools.permutations(n, 2):
    n_ = copy.copy(n)
    n_.remove(p0)
    n_.remove(p1)
    total = int("".join([p0, p1])) + int(n_[0])
    ans = max(ans, total)
print(ans)

n = list(map(int, input().split()))
nmax = max(n)
n.remove(nmax)
ans = nmax * 10 + sum(n)
print(ans)

-import itertools, copy - -n = input().split() -ans = 0 -for p0, p1 in itertools.permutations(n, 2): -    n_ = copy.copy(n) -    n_.remove(p0) -    n_.remove(p1) -    total = int("".join([p0, p1])) + int(n_[0]) -    ans = max(ans, total) +n = list(map(int, input().split())) +nmax = max(n) +n.remove(nmax) +ans = nmax * 10 + sum(n)