time_10 = []
min_time = 9
old = -10
for x in range(5):
    tmp = int(input())
    m = tmp % 10
    if m == 0:
        time_10.append(tmp)
        
    elif m < min_time:
        min_time = m
        time_10.append(((old // 10) + 1) * 10)
        old = tmp
        
    else:
        time_10.append(((tmp // 10) + 1) * 10)
        

print(sum(time_10)+old)

