res = 0
minS = 10
for i in range(5):
  N = int(input())
  s = N % 10
  t = N // 10
  if s == 0:
    res = res + t * 10
  else:
    minS = min(minS, s)
    res = res + (t + 1)*10
if minS != 10:
  minS -= 10
print(minS + res)