a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

def get(x):
    x = x % 10
    if x == 0:
        return 10
    else:
        return x

A = get(a)
B = get(b)
C = get(c)
D = get(d)
E = get(e)


x = min([A, B, C, D, E]) 
if x == 10:
    x = 0

print(10 * ((-(-a // 10) + -(-b // 10) + -(-c // 10) + -(-d // 10) + -(-e // 10))) + x - 10)