import itertools
import math

A = []
for i in range(5):
    A.append(float(input()))

B = list(itertools.permutations(A))
M = 123 * 5
for i in range(120):
    c = 0
    for j in range(4):
        c += math.ceil(B[i][j]/10) * 10
    c += B[i][4]
    M = min(M, c)
print(int(M))
  