#include using namespace std; using ll = long long; using P = pair; using T = tuple; const ll INF = 1e10; int main() { cin.tie(0); ios::sync_with_stdio(false); ll a, b, c, d; cin >> a >> b >> c >> d; ll m = a * d - b * c; if (m == 0) { ll mx = __gcd(a, c); ll my = __gcd(b, d); if (mx == 0) mx = INF; if (my == 0) my = INF; set s; int n; cin >> n; for (int i = 0; i < n; i++) { ll x, y; cin >> x >> y; s.emplace(b * x - a * y, x % mx, y % my); } cout << s.size() << "\n"; return 0; } if (m < 0) { m = -m; a = (m - a % m) % m; b = (m - b % m) % m; c = (m - c % m) % m; d = (m - d % m) % m; } set

s; int n; cin >> n; for (int i = 0; i < n; i++) { ll x, y; cin >> x >> y; ll xx = (d * x % m + m - c * y % m) % m; ll yy = (a * y % m + m - b * x % m) % m; P tar(xx, yy); s.insert(tar); } cout << s.size() << "\n"; return 0; }