times = [int(input()) for _ in range(5)]

amarino_times = [i % 10 for i in times]

min_index = amarino_times.index(min(amarino_times))

last_choose_time = times.pop(min_index)


sum = 0
for i in times:
    sum += i
    if i % 10 != 0:
        sum += 10 - (i % 10)

sum += last_choose_time

hoge = 0
for i in amarino_times:
    if i == 0:
        hoge += 1
for i in range(hoge):
    fuga = amarino_times.pop(amarino_times.index(min(amarino_times)))
print(hoge)
if hoge:
    sum -= min(amarino_times)


print(sum)
