n = [int(input()) for _ in range(5)]
first_digit = []
for num in n:
    z = int(str(num)[-1])
    if z > 0:
        first_digit.append(z)
    else:
        first_digit.append(0.001)

# print(first_digit)
t = 0
for i in range(len(n)):
    t += -(-n[i] // 10) * 10

print(int(t - (10 - min(first_digit))))
