l = [int(input()) for i in range(5)]
min = l[0] % 10
min_index = 0
sum = 0
for i in range(1, len(l)):
    if l[i] % 10 != 0 and l[i] % 10 < min:
        min = l[i]
        min_index = i
for i in range(len(l)):
    if i != min_index:
        sum += (l[i] + 9) // 10 * 10
sum += l[min_index]
print(sum)