A = list(map(int, open(0).read().split()))
A = [(a, a%10) for a in A]
zeros = list(filter((lambda x: x[1] == 0), A))
A = list(filter((lambda x: x[1] != 0), A))
m = min(A, key=(lambda x: x[1]))[0]
A = list(filter((lambda x: x[0] != m), A))

s = sum([z[0] for z in zeros])
for a in A:
    a = a[0]
    t = (a//10+1)*10
    s += t

print(s + m)