#include <bits/stdc++.h>
using namespace std;
long long n, m, dx, dy;
long long x, y;
const int MAXN = 1e6 + 10;
map<long long, int> a;
int main() {
  cin >> n >> m >> dx >> dy;
  int maxn = 0;
  int xx, yy;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    int tmp = (x * dy - dx * y + n * MAXN) % n;
    a[tmp]++;
    if (a[tmp] > maxn) {
      maxn = a[tmp];
      xx = x;
      yy = y;
    }
  }
  cout << xx << " " << yy << endl;
  return 0;
}
