l = list(map(int,input().split()))

l = sorted(l)

l = l[::-1]

print((l[0]*9+sum(l)))

l = list(map(int,input().split()))

print((sum(l) + 9*(max(l))))

l = list(map(int, input().split()))
l = sorted(l)
l = l[::-1]
print((l[0] * 9 + sum(l)))

l = list(map(int, input().split()))
print((sum(l) + 9 * (max(l))))

-l = sorted(l) -l = l[::-1] -print((l[0] * 9 + sum(l))) +print((sum(l) + 9 * (max(l))))