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

times = []
#for num in ins:
tmp = []
for _ in range(5):
    num = int(input())
    if num % 10 == 0:
        time = num
    else:
        time = num - num % 10 + 10
    times.append(time)
    tm = num % 10
    if tm >= 1:
        tmp.append(tm)
    #print(num)
    yobun = min(tmp)

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

if yobun == 0:
    yobun = 10

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