#include <bits/stdc++.h>
using namespace std;
int n, m, cnt[1000005], dx, dy, maxi = 0, bx, by;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> dx >> dy;
  for (int i = 0; i < m; i++) {
    long long x, y, tmp;
    cin >> x >> y;
    tmp = (dy * x - dx * y) % n;
    if (tmp < 0) tmp += n;
    cnt[tmp]++;
    if (cnt[tmp] > maxi) {
      maxi = cnt[tmp];
      bx = x;
      by = y;
    }
  }
  cout << bx << " " << by;
}
