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