#include <bits/stdc++.h>
using namespace std;
long long N, M, DX, DY, X, Y;
unordered_map<long long, int> apples;
int main() {
  int b = 0, x = 0, y = 0;
  cin >> N >> M >> DX >> DY;
  for (int i = 0; i < M; i++) {
    cin >> X >> Y;
    long long key = (Y * DX - X * DY) % N;
    if (key < 0) key += N;
    apples[key]++;
    if (apples[key] > b) {
      b = apples[key];
      x = X;
      y = Y;
    }
  }
  cout << x << " " << y << endl;
}
