# coding: utf-8
minutes = [int(input()) for _ in range(5)]
time=0
l=[]

for i in minutes:
    time = time + i
    if(i%10==0):
        l.append(0)
    else:
        l.append(10-i%10)

l.sort()
time = time + sum(l[:-1])
print(time)