import sys
import numpy

a_t=int(input())
b_t=int(input())
c_t=int(input())
d_t=int(input())
e_t=int(input())

a_d = a_t % 10
b_d = b_t % 10
c_d = c_t % 10
d_d = d_t % 10
e_d = e_t % 10

# dishes = {'a': a_d, 'b': b_d, 'c': c_d, 'd': d_d, 'e': e_d}
dish_d = [a_d, b_d, c_d, d_d, e_d]
d_list = [a_t, b_t, c_t, d_t, e_t]

# min_dish = min(dishes, key=dishes.get)

time = (a_t // 10 + b_t  // 10 + c_t // 10 + d_t // 10 + e_t // 10 + 5) * 10 - (10 - min(dish_d))
print(time)