
arr = []
for i in range(5):
    arr.append(int(input()))
index = 0
rem_arr = []
for i in arr:
    time = i % 10
    if time == 0:
        time += 9
    rem_arr.append(time)
last_index = min(enumerate(rem_arr), key=lambda x: x[1])[0]
last = arr[last_index]
arr.pop(last_index)
total = 0
for i in arr:
    h = (i // 9) * 10
    total += h
total += last
print(total)