def solve():
    time_dish=[0]*5
    for i in range(5):
        time_dish[i]=int(input())
    time=0
    x=10
    for i in range(5):
        #if time_dish[i]%10 != 10:
        time += math.ceil(time_dish[i]/10)*10
        if (time_dish[i]%10 != 0) and (x > time_dish[i]%10):
            x = time_dish[i]%10
    print(time-10+x)

solve()