object Main extends App {
  var a = List(readInt,readInt,readInt,readInt,readInt)
  var min = 10
  var sum = 0
	a.foreach(i => {
    	if(i%10!=0&&min>i%10)min=i%10
      	if(i%10!=0)
		    sum += i+10-(i%10)
      	else
	    	sum += i
    })
  println(sum - 10 + min)
}