import numpy as np
ins = [int(input()) for _ in range(5)] 

times = []
for num in ins:
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    #print(num)

tmp = np.asarray(ins) % 10
tmp = tmp[tmp >= 1]
yobun = np.min(tmp)

if yobun == 0:
    yobun = 10

all_time = np.sum(times) - (10-yobun)
print(all_time)