a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

menu = [a, b, c, d, e]

time = 0
count = 0
for i in range(5):
    if menu[i] % 10 == 0:
        tmp = menu[count]
        menu[count] = menu[i]
        menu[i] = tmp
        count += 1
           

while True:
    flg = 0
    for i in range(4-count):
        num1 = menu[i+count]
        num2 = menu[i+count+1]
        if num1 % 10 < num2 % 10:
            menu[i+count] = num2
            menu[i+count+1] = num1
            flg = flg + 1
    if flg == 0:
        break
print(menu)

for i in range(5):
    time += menu[i]
