s = [input() for i in range(5)]
x10 = int(0)
sum = int(0)
a = []

for i in range(5):
  if int(s[i]) % 10 == 0:
    x10 = x10 + 1
  else:
    pass
  sum = sum + ((int(s[i]) - 1) // 10 + 1) * 10
  a.append(int(s[i]) % 10)
  
b = [int(s) for s in a]

if x10 == 5:
  print(sum)
else:
  print(sum - 10 + min(b))