1. Abridged Problem Statement  
You are given integers a, b, c and two intervals [x1, x2], [y1, y2]. Count the number of integer pairs (x, y) satisfying  
  a·x + b·y + c = 0  
and  
  x1 ≤ x ≤ x2, y1 ≤ y ≤ y2.

2. Detailed Editorial  
We want all integer solutions to a·x + b·y = –c that lie in the rectangle [x1, x2]×[y1, y2].

Step A. Handle trivial cases:  
- If a = 0 and b = 0, the equation is c = 0.  
  • If c = 0, every (x,y) in the rectangle is a solution, so answer = (x2−x1+1)·(y2−y1+1).  
  • Otherwise, no solutions.  
- If exactly one of a or b is zero, the equation becomes in one variable; check whether –c is divisible by the nonzero coefficient, solve for that variable, and see if it lies in its interval. If so, any integer in the free variable’s interval is valid.

Step B. General case a≠0, b≠0.  
1. Compute g = gcd(|a|,|b|) and find one particular solution (x0, y0) to a·x + b·y = –c via the extended Euclidean algorithm. If g does not divide –c, there are no integer solutions.  
2. All solutions are given by  
  x = x0 + (b/g)·t,  
  y = y0 − (a/g)·t,  
   where t is any integer.  
3. Impose the interval constraints on x and y to get inequalities on t:  
  x1 ≤ x0 + (b/g)·t ≤ x2  
  y1 ≤ y0 − (a/g)·t ≤ y2  
   Solve each for t to get two intervals [t_min_x, t_max_x] and [t_min_y, t_max_y].  
4. The intersection of these t-intervals gives all valid t values; its size (if positive) is the answer.

Edge considerations: the step of converting the two inequalities to bounds on t requires careful handling of the sign of the stepsize b/g or –a/g.

Complexity is dominated by extended gcd, which is O(log max(|a|,|b|)), easily within limits.

3. Provided C++ Solution with Line-by-Line Comments  
#include <bits/stdc++.h>  
using namespace std;

// Overload to print a pair
template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &x) {
    return out << x.first << ' ' << x.second;
}

// Overload to read a pair
template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &x) {
    return in >> x.first >> x.second;
}

// Read into vector
template<typename T>
istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x: a) in >> x;
    return in;
}

// Print vector
template<typename T>
ostream &operator<<(ostream &out, const vector<T> &a) {
    for(auto x: a) out << x << ' ';
    return out;
}

// Extended Euclidean algorithm: returns g = gcd(a,b) and finds x,y such that a*x + b*y = g
int64_t extend_gcd(int64_t a, int64_t b, int64_t &x, int64_t &y) {
    if(b == 0) {
        x = 1;      // base solution: a*1 + 0*0 = a
        y = 0;
        return a;
    }
    int64_t x1, y1;
    int64_t d = extend_gcd(b, a % b, x1, y1);
    // back-substitute to compute x,y for original a,b
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

int64_t a, b, c;                  // coefficients
pair<int64_t, int64_t> range_x;   // [x1, x2]
pair<int64_t, int64_t> range_y;   // [y1, y2]

// Read input
void read() {
    cin >> a >> b >> c;
    cin >> range_x >> range_y;
}

// Compute the smallest integer k such that x + k*delta >= range.first (if delta>0) or <=
int64_t first_in_range_k(
    pair<int64_t, int64_t> range, int64_t x, int64_t delta
) {
    if(delta > 0) {
        if(x < range.first) {
            // need to increase x, so k = ceil((range.first - x) / delta)
            int64_t k = (range.first - x + delta - 1) / delta;
            return k;
        } else {
            // x already ≥ low bound, we can step down
            int64_t k = (x - range.first) / delta;
            return -k;
        }
    } else {
        // similar logic when delta < 0
        if(x >= range.first) {
            int64_t k = (x - range.first) / (-delta);
            return k;
        } else {
            int64_t k = (range.first - x - delta - 1) / (-delta);
            return -k;
        }
    }
}

// Compute the largest integer k such that x + k*delta ≤ range.second
int64_t last_in_range_k(
    pair<int64_t, int64_t> range, int64_t x, int64_t delta
) {
    if(delta > 0) {
        if(x > range.second) {
            int64_t k = (x - range.second + delta - 1) / delta;
            return -k;
        } else {
            int64_t k = (range.second - x) / delta;
            return k;
        }
    } else {
        if(x <= range.second) {
            int64_t k = (range.second - x) / (-delta);
            return -k;
        } else {
            int64_t k = (x - range.second - delta - 1) / (-delta);
            return k;
        }
    }
}

// Check if a value is outside a closed interval
bool not_in_range(int64_t x, pair<int64_t, int64_t> range) {
    return x < range.first || x > range.second;
}

void solve() {
    // Move constant to RHS: a x + b y = -c
    c = -c;

    // Normalize signs so that b ≥ 0 (optional convenience)
    if(b < 0) {
        a = -a; b = -b; c = -c;
    }

    // Case both zero
    if(a == 0 && b == 0) {
        if(c == 0) {
            // Every point in rectangle
            cout << (range_x.second - range_x.first + 1)
                 * (range_y.second - range_y.first + 1)
                 << '\n';
        } else {
            cout << 0 << '\n';
        }
        return;
    }

    // Use extended gcd to find any solution of a x + b y = g
    int64_t x0, y0;
    int64_t g = extend_gcd(a, b, x0, y0);

    // No solution if –c not divisible by g
    if(c % g) {
        cout << 0 << '\n';
        return;
    }

    // Scale the base solution to match a x + b y = c
    x0 *= c / g;
    y0 *= c / g;

    // Step sizes for t in general solution
    int64_t delta_x = b / g;
    int64_t delta_y = -a / g;

    // Compute range of t-values so that x stays in [x1,x2] and y in [y1,y2]
    int64_t lxk = first_in_range_k(range_x, x0, delta_x);
    int64_t rxk = last_in_range_k(range_x, x0, delta_x);
    int64_t lyk = first_in_range_k(range_y, y0, delta_y);
    int64_t ryk = last_in_range_k(range_y, y0, delta_y);

    // If even the boundary points fall outside, no solutions
    if(not_in_range(x0 + lxk * delta_x, range_x) ||
       not_in_range(y0 + lyk * delta_y, range_y) ||
       not_in_range(x0 + rxk * delta_x, range_x) ||
       not_in_range(y0 + ryk * delta_y, range_y)) {
        cout << 0 << '\n';
        return;
    }

    // Ensure intervals are low to high
    if(lxk > rxk) swap(lxk, rxk);
    if(lyk > ryk) swap(lyk, ryk);

    // The intersection length is the count of integer t
    int64_t ans = max(0ll, min(rxk, ryk) - max(lxk, lyk) + 1);
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    read();
    solve();
    return 0;
}

4. Python Solution with Detailed Comments  
```python
import sys
sys.setrecursionlimit(10**7)

# Extended GCD: returns (g, x, y) with a*x + b*y = g
def ext_gcd(a, b):
    if b == 0:
        return (a, 1, 0)
    g, x1, y1 = ext_gcd(b, a % b)
    # back-substitute
    x = y1
    y = x1 - (a // b) * y1
    return (g, x, y)

# Given range [l, r], base value x, and step delta,
# find smallest integer k with x + k*delta >= l
def first_k(l, x, delta):
    if delta > 0:
        if x < l:
            return (l - x + delta - 1) // delta
        else:
            return -((x - l) // delta)
    else:
        # delta < 0
        if x >= l:
            return (x - l) // (-delta)
        else:
            return -((l - x + (-delta) - 1) // (-delta))

# Find largest integer k with x + k*delta <= r
def last_k(r, x, delta):
    if delta > 0:
        if x > r:
            return -((x - r + delta - 1) // delta)
        else:
            return (r - x) // delta
    else:
        if x <= r:
            return -((r - x) // (-delta))
        else:
            return (x - r + (-delta) - 1) // (-delta)

# Read input
a, b, c = map(int, sys.stdin.read().split())
# c on LHS, so move to RHS
c = -c
x1, x2, y1, y2 = map(int, sys.stdin.read().split())

# Case a=b=0
if a == 0 and b == 0:
    if c == 0:
        print((x2 - x1 + 1) * (y2 - y1 + 1))
    else:
        print(0)
    sys.exit(0)

# Handle sign so b>=0
if b < 0:
    a, b, c = -a, -b, -c

# Use ext_gcd to solve a*x + b*y = g
g, x0, y0 = ext_gcd(abs(a), abs(b))
# adjust signs if a or b were negative
if a < 0: x0 = -x0
if b < 0: y0 = -y0

# No solution if c not divisible by g
if c % g != 0:
    print(0)
    sys.exit(0)

# Scale base solution to match exactly a*x + b*y = c
x0 *= c // g
y0 *= c // g

# General solution: x = x0 + (b/g)*t, y = y0 - (a/g)*t
dx = b // g
dy = -a // g

# Compute t-ranges for x and y bounds
lx = first_k(x1, x0, dx)
rx = last_k(x2, x0, dx)
ly = first_k(y1, y0, dy)
ry = last_k(y2, y0, dy)

# Ensure the endpoints actually lie in the rectangle
def in_range(v, low, high):
    return low <= v <= high

# If extremes fall outside, zero solutions
if not in_range(x0 + lx*dx, x1, x2) or not in_range(x0 + rx*dx, x1, x2) \
   or not in_range(y0 + ly*dy, y1, y2) or not in_range(y0 + ry*dy, y1, y2):
    print(0)
    sys.exit(0)

# Normalize
if lx > rx: lx, rx = rx, lx
if ly > ry: ly, ry = ry, ly

# Intersection of [lx, rx] and [ly, ry]
lo = max(lx, ly)
hi = min(rx, ry)
print(max(0, hi - lo + 1))
```

5. Compressed Editorial  
Use extended GCD to find a particular integer solution to a·x + b·y = –c. All solutions form a one-parameter family x = x0 + (b/g)t, y = y0 − (a/g)t. Convert the box constraints into two intervals for t, intersect them, and the intersection length is the answer. Handle special cases a=0 or b=0 separately and watch for overflow by using 64-bit arithmetic.