a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a,b,c,d,e]

lst2 = []

for x in lst:
    amari = x % 10
    if amari == 0:
        pass
    else:
        lst2.append(10 - amari)

lst2.remove(max(lst2))
print(sum(lst)+sum(lst2))