#include <bits/stdc++.h>
using namespace std;
long long A[2002], B[2002];
long long find_dist(long long x1, long long y1, long long x2, 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 ans = 0;
  for (int i = 1; i <= N; i++) {
    long long x, y;
    cin >> x >> y;
    A[i] = find_dist(x, y, x1, y1);
    B[i] = find_dist(x, y, x2, y2);
    ans = max(ans, A[i]);
  }
  for (int i = 1; i <= N; i++) {
    long long R2 = B[i], R1 = 0;
    for (int j = 1; j <= N; j++) {
      if (B[j] > R2) R1 = max(R1, A[j]);
    }
    ans = min(ans, R1 + R2);
  }
  printf("%lld", ans);
  return 0;
}
