from math import ceil
def fanc(x):
    return round((ceil(x/10))*10)
menu = [int(input()) for _ in range(5)]
menu.sort(key=lambda x:x%10)
for i in range(5):
    if menu[i]%10:
        ans = menu.pop(i)
        break
menu = list(map(fanc, menu))
print(ans+sum(menu))