A = [int(input()) for i in range(5)]
min_1 = 10
sum_v = -10

for num in A:
    dig1 = num % 10
    if dig1:
        min_1 = min(min_1, dig1)

    if dig1:
        sum_v += (num // 10) * 10 + 10
    else:
        sum_v += num

if min_1 != 10:
    print(sum_v + min_1)
else:
    print(sum_v + min_1 + 10)