a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
f = [a,b,c,d,e]
g = 0
sm = float('inf')
for i in f:
    if i %10 == 0:
        g = g+ i
    else:
        g = g + 10*(i//10)+10
        if i%10 < sm:
            sm = i%10


print(sm+g-10)
