lis = []
lis2 = []
lis3 = []
mi = 1000000000

for i in range(5):
  a = int(input())
  lis.append(a)
  
for x in lis:
  x2 = x % 10
  if x2 == 0:
    x3 = x
  else:
    x3 = x - x2 + 10
  lis2.append(x2)
  lis3.append(x3)
  
for i in lis2:
  if i != 0:
    if i < mi:
      mi = i

su = sum(lis3)

ans = su + mi - 10

print(ans)