A, B, C, D, E = [int(input()) for _ in range(5)]

menu = [A, B, C, D, E]

time_dig = [-(-food // 10) for food in menu]
time_min_mod_10 = min([_ % 10 for _ in menu if _ % 10 != 0])

print((sum(time_dig) - 1) * 10 + time_min_mod_10)