#coding: euc-jp
class Main
  def self.main
    min = 10
    cnt = 0
    5.times do
      a = read
      min = a % 10 if (a - 1) % 10 < (min - 1) % 10
      cnt += (a / 10) * 10 + (a % 10 == 0 ? 0 : 10)
    end
    cnt -= 10 - min
    puts cnt
  end

  def self.read
    gets.chomp.to_i
  end
end

Main.main
