A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

X = [A, B, C, D, E]
Y = [[x, 10-x%10] for x in X]
acc = 0
for y in Y:
    if y[1] == 10:
        acc += y[0]
    else:
        acc += y[0] + y[1]
Z = [10-a%10 for a in X if (10-a%10) < 10]
acc -= max(Z)
print(acc)
