M = [int(input()) for _ in range(5)]
N = []
n = []
T = 0
for i in range(5):
    N.append(M[i] % 10)
    if M[i] % 10 == 0:
        T += M[i]
    else:
        T += M[i]
        T += 10 - M[i] % 10
        n.append(M[i] % 10)
for i in range(5):
    if max(N) > 0:
        print(T - (10 - min(n)))
        break
    else:
        print(T)