a = (input())
b = (input())
c = (input())
d = (input())
e = (input())
ary = [a,b,c,d,e]
ary_simo = []
for s in ary:
    if int(s[-1]) != 0:
        ary_simo.append(int(s[-1]))
ary_2 = []
for s in ary:
    ary_2.append(round(int(s) + 5, -1))
try:
    print(sum(ary_2) - 10 + min(ary_simo))
except:
    print(sum(ary_2))
