s=[int(input()) for i in range(5)]
a=0
b=10
for i in s:
    for j in range(0,130,10):
        if j>=i:
            a+=j
            break
    if i%10>0:
        b=min(b,i%10)

if b==10:
    print(a)
else:
    print(a-10+b)
