program Tax_Increase
    implicit none
    real(8):: a,b
    integer(8):: amax, bmax, amin, bmin

    read*, a,b


    amin = ceiling((a)/8d-2)
    amax = ceiling((a+1)/8d-2)-1
    bmin = ceiling((b)/10d-2)
    bmax = ceiling((b+1)/1d-1)-1

    if (amax < bmin .or. bmax < bmin) then
        print*, -1
    else
        print*, max(amin,bmin)
    end if

end program Tax_Increase