from numpy import array, argmax, ones

InRange = 5

# 入力受け取り
a_e = array([int(input()) for i in range(InRange)])

# 1桁目が0以外で最小
a_e10 = 10 - a_e % 10
a_e10[a_e10 == 10] = 0

sum_index = ones(InRange, dtype=bool)
sum_index[argmax(a_e10)] = False

sum_time = a_e.sum() + a_e10[sum_index].sum()