from math import *

def comTime(x):
  return ceil(x/10) * 10

def solve(_l):
  s = 0
  l =sorted(_l, key=lambda x: x % 10)
  s += sum(map(comTime,l[1:])) + l[0]
  return s
  
_l = [int(input()) for _ in range(5)]
print(solve(_l))