#include <bits/stdc++.h>
using namespace std;
long long dis(long long x1, long long x2, long long y1, long long y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
  int n;
  cin >> n;
  long long x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  long long x[n + 1], y[n + 1];
  for (int i = 0; i < (int)(n); ++i) {
    cin >> x[i] >> y[i];
  }
  x[n] = x1, y[n] = y1;
  long long ans = 1e18;
  for (int i = 0; i < n + 1; i++) {
    long long r1 = dis(x[i], x1, y[i], y1);
    long long r2 = 0;
    for (int j = 0; j < n + 1; j++) {
      long long val = dis(x[j], x2, y[j], y2);
      long long val1 = dis(x[j], x1, y[j], y1);
      if (val1 > r1) {
        r2 = max(r2, val);
      }
    }
    ans = min(ans, r1 + r2);
  }
  cout << ans;
  return 0;
}
