#include #include #include typedef std::int_fast32_t s32; typedef std::uint_fast32_t u32; typedef std::int_fast64_t s64; typedef std::uint_fast64_t u64; const unsigned long mod = 1000000007; const double EPS = 0.00000001; const int INF = (1 << 29); typedef std::pair P; template void print_array(T *A_, s32 size) { printf("%d\n", size); if( size != 0 ) { for(int i = 0; i < size - 1; ++i) { printf("%d ", A_[i]); } printf("%d\n", A_[size - 1]); } } int d; int a, b, c; int p1(void) { if( a == 0 or c == 0 ) return INF; if( a < b and c < b ) return 0; if( a > b and c > b ) return 0; if( a == b ) return INF; if( d == 0 ) return INF; return (b - std::min(a, c)) / d + 1; } int p2(void) { if( b == 0 ) return INF; if( a < b and c < b ) return 0; if( d == 0 ) return INF; int res = 0; if( c >= b ) { res += (c - b) / d + 1; } if( a >= b ) { res += (a - b) / d + 1; } return res; } int main() { std::cin >> d; std::cin >> a >> b >> c; int res = INF; res = std::min(res, p1()); res = std::min(res, p2()); if( res == INF ) res = -1; std::cout << res << std::endl; //std::cout << p1() << " " << p2() << std::endl; return 0; }