import math
 
a = []
for i in range(5):
  a.append(int(input()))

m = 0
j = 0
for i in range(5):
  if a[i] % 10 < m:
          m = a[i] % 10
          j = i

a[j], a[4] = a[4], a[j]

for i in range(5):
  if i != 4:
        a[i] = int(math.ceil(a[i] / 10) * 10)
  #print(a)
  
print(sum(a))