a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
lst = [a,b,c,d,e]
last = 9
ttl = 0
for i in range(5):
    if lst[i]%10 != 0:
        ttl += (lst[i]+(10-lst[i]%10))
    if lst[i]%10 == 0:
        ttl += lst[i]
    if 0 <(lst[i]%10) <= last:
        last = lst[i]%10
print(ttl-(10-last))