import math

x = []
sum = 0
min = 0
for i in range(5):
    x = input()
    y = x % 10
    if y == 0:
        sum += x
    else:
        sum += x + 10 - y
        if min == 0:
            min = y
        elif y < min:
            min = y

if min == 0:
    print(sum)
else:
    print(sum - 10 + min)