package main

import (
	"fmt"
	"sort"
)

var (
	a []int
)

func main() {
	a = make([]int, 5)
	fmt.Scan(&a[0])
	fmt.Scan(&a[1])
	fmt.Scan(&a[2])
	fmt.Scan(&a[3])
	fmt.Scan(&a[4])

	sort.Slice(a, func(i, j int) bool {
		if a[i]%10 == 0 {
			return true
		}
		if a[j]%10 == 0 {
			return false
		}
		return a[i]%10 > a[j]%10
	})

	sum := 0
	for _, t := range a[:len(a)-1] {
		if t%10 > 0 {
			t += 10 - (t % 10)
		}
		sum += t
	}
	sum += a[len(a)-1]

	fmt.Println(sum)
}
