#include using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) using Graph = vector>; ll mod=1e9+7; int main() { ll A,B,C,D; cin>>A>>B>>C>>D; ll N; cin>>N; set> S; if(A*D-B*C==0) rep(i,N){ ll X,Y; cin>>X>>Y; S.insert(make_pair(D*X-C*Y,A*Y-B*X)); } else rep(i,N){ ll X,Y; cin>>X>>Y; S.insert(make_pair((D*X-C*Y)%(A*D-B*C),(A*Y-B*X)%(A*D-B*C))); } cout<