
import math
a = []
for i in range(5):
    a.append(int(input()))

max_a_idx = -1
max_dif = 0
for i in range(5):
    if a[i]%10!=0:
        x = 10-(a[i]%10)
        if x > max_dif:
            max_dif=x
            max_a_idx=i


time = 0
for i in range(5):
    if i!=max_a_idx:
        if a[i]%10!=0:
            time += (a[i]+(10-a[i]%10))
        else:
            time += a[i]
        #print(str(a[i])+" "+str(time))

time += a[max_a_idx]
print(time)