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

def x(i):
    if i % 10 != 1:
        return i + (10 - i%10)
    return i

print(x(a) + x(b) + x(c) + x(d) + x(e))
