#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, dx, dy, ans = 0, a, b;
  map<long long, int> num;
  double k;
  scanf("%lld%lld%lld%lld", &n, &m, &dx, &dy);
  long long x, y;
  for (int i = 0; i < m; i++) {
    scanf("%lld%lld", &x, &y);
    k = ((dy * x - dx * y) % n + n) % n;
    num[k]++;
    if (ans < num[k]) {
      a = x;
      b = y;
      ans = num[k];
    }
  }
  printf("%lld %lld\n", a, b);
  return 0;
}
