SUM = 0
MIN = 9999
for i in range(5):
    s = int(input())
    smod = int(s % 10)
    if smod == 0:
        SUM += s
    else:
        SUM += s - smod + 10 
        MIN = min(MIN,smod)
print(SUM + MIN - 10)
 