import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val ABCDE = Array.fill(5)(sc.nextInt)

    val t = ABCDE.map(i => (i + 9) / 10 * 10).sum
    val m = ABCDE.map(_ % 10).filter(_ > 0).min
    (t - (10 - m)).toString
  }
}
