import math
a = 0
b = 0
c = 0
d = 0
e = 0
ls = [a,b,c,d,e]
for i in range(len(ls)):
    ls[i] = int(input())
for i in ls:
    if i > 9:
        i = i/10
ans = 0
for i in ls:
    ans += math.ceil(i)

one = 0
lsls = []
for i in range(len(ls)):
    ls_one = str(ls[i])
    one += int(ls_one[-1])
    if int(ls_one[-1]) > 0:
    	lsls.append(10-int(ls_one[-1]))
    
lsls.remove(max(lsls))
print(ans+sum(lsls))