#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
vector<pair<int, int> > v[N];
int n, m, dx, dy;
int main() {
  scanf("%d%d%d%d", &n, &m, &dx, &dy);
  for (int i = 0, x, y; i < m; i++) {
    scanf("%d%d", &x, &y);
    long long temp = dx * 1LL * y - dy * 1LL * x;
    temp += n * 1LL * n;
    temp %= n;
    v[temp].push_back({x, y});
  }
  int mx = 0;
  pair<int, int> ans;
  for (int i = 0; i < n; i++) {
    if (v[i].size() > mx) {
      mx = v[i].size();
      ans = v[i].back();
    }
  }
  printf("%d %d\n", ans.first, ans.second);
}
