import math

time_list = list()

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


def key_func(x):
    if x < 100:
        if x % 10 == 0:
            return 10
        return x % 10  # ex: 19の場合は9を返す
    else:
        if x % 100 == 0:
            return 10
        return x % 100  # ex: 123の場合は3を返す


time_list.sort(key=key_func, reverse=True)

print(time_list)

ans = sum
for i, time in enumerate(time_list):
    if i < len(time_list) - 1:
        ans += math.ceil(time / 10) * 10
    else:
        ans += time

print(ans)
