program prob3
    implicit none
    integer :: a(5), ans, i, mi
    read(*,*) a
    ans = 0
    do i = 1, 5
        ans = ans + a(i)
        ans = ((ans - 1) / 10 + 1) * 10
    end do
    mi = 10
    do i = 1, 5
        if(mod(a(i), 10) == 0) then
            cycle
        end if
        mi = min(mod(a(i), 10), mi)
    end do
    ans = ans - (10 - mi)
    write(*,*) ans

    stop
contains
end program prob3