package main

import (
  "fmt"
  "math"
)

func main() {
  A := make([]int, 5)
  B := make([]int, 5)
  for i := 0; i < 5; i++ {
    fmt.Scan(&A[i])
    B[i] = A[i]
  }
  var (
    minModI, sumB int
    minMod        = math.MaxInt32
  )
  for i := 0; i < 5; i++ {
    if mod := A[i] % 10; mod != 0 {
      B[i] += 10 - mod
      if mod < minMod {
        minMod = B[i]
        minModI = i
      }
    }
    sumB += B[i]
  }
  fmt.Println(sumB - B[minModI] + A[minModI])
}
