import strutils, sequtils, math, algorithm

var
  a = stdin.readline.parseInt
  b = stdin.readline.parseInt
  c = stdin.readline.parseInt
  d = stdin.readline.parseInt
  e = stdin.readline.parseInt
  a1 = a mod 10
  b1 = b mod 10
  c1 = c mod 10
  d1 = d mod 10
  e1 = e mod 10
  t = min(a1,b1,c1,d1,e1)
  a2 = a - a1 + 10
  b2 = b - b1 + 10
  c2 = c - c1 + 10
  d2 = d - d1 + 10
  e2 = e - e1 + 10

echo (a2 + b2 + c2 + d2 + e2 - 10 + t)