# A~Eの１の位が（0を除いて）最も小さいものを最後に頼めばよい
import numpy as np
A = np.zeros(5)
B = np.zeros(5)
time = 0
for i in range(5):
    A[i] = int(input())
    if A[i] % 10 == 0:
        B[i] = 10
    else:
        B[i] = A[i] % 10

for j in range(5):
    for k in range(j, 4):
        if B[k] > B[k + 1]:
            B[k], B[k + 1] = B[k + 1], B[k]
            A[k], A[k + 1] = A[k + 1], A[k]
time += A[0]
for h in range(1, 5):
    time += A[h]+10-B[h]
print("{}".format(int(time)))
