from math import *
plate = [int(input()) for i in range(5)]
amari = [plate[i]%10 for i in range(5)]
ans = 0

def kiriage(n):
    return n + (10 - n%10)

for i in range(5):
    ans += kiriage(plate[i])

ans -= max(amari)
print(ans)
