a = []
b = [0]
ans = 0

for i in range(5):
    A = int(input())
    B = A % 10
    if B != 0:
        A = A + (10 - B)
        b.append(B)
    a.append(A)
ans = sum(a) - (10 - sorted(set(b))[1])
print(ans)