num=[]
a=[] 
time = 0 
for i in range(5):
    num.append(int(input()))
    if num[i]%10 == 0:
        a.append(0)
    else:
        a.append(10 - num[i]%10)
    time += num[i] + a[i]

time -= max(a)
time