import math

cook = []
for i in range (5):
    cook.append(int(input()))

times = 0
# mod10が最小のもの(0除く)を最後にすれば最小？
min_10 = []
for c in range(len(cook)):
    min_10.append((cook[c] - 1) % 10)  # 0覗いて最小になるように、cookから1引いたもののmod10を比較

min_index = min_10.index(min(min_10))
print(min_10, min_index)
total_time = 0
for c in range(len(cook)):
    if min_index == c:
        continue
    else:
        total_time += int(math.ceil(cook[c] / 10) * 10)
total_time += cook[min_index]

print(total_time)