a = [int(input()) for i in range(5)]

b = []

for i in a:
    n = i % 10
    b.append(n)

c = [i for i in b if i > 0]
c.sort()

sum = 0
for j in a:
  sum += j
 
n = 0
for k in c:
    n += 10 - k

N = sum + n + (c[0] - 10)
print(N)