time = [int(input()) for i in range(5)]
ten_time = 0
smallest_mod = 9
for i in range(5):
    div,mod = divmod(time[i],10)
    if mod < smallest_mod:
        smallest_mod = mod
    if mod != 0:
        ten_time += div + 1
    else:ten_time += div
print(ten_time * 10 - 10 + smallest_mod)