# -*- coding: utf-8 -*-

import math


order = []

for _ in range(5):
    order.append(int(input()))

sorted_order = sorted(order, key=lambda x: (x - 1) % 10, reverse=True)

print(sorted_order)

t = 0
for i, n in enumerate(sorted_order):
    if i == len(sorted_order) - 1:
        t += n
    else:
        t += math.ceil(n / 10) * 10

print(int(t))
