A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
M = [A, B, C, D, E]
N = []
n = []
T = 0
for i in range(5):
    if M[i] % 10 == 0:
        T += M[i]
    else:
        T += M[i]
        T += 10 - M[i] % 10
        n.append(M[i] % 10)
print(T - (10 - min(n)))