#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
bool chmin(T1 &a, T2 b) {
  return b < a && (a = b, true);
}
template <class T1, class T2>
bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
const long double eps = 1e-10;
int main() {
  int n;
  long double x1, y1, x2, y2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  complex<long double> p(x1, y1), q(x2, y2);
  p -= q;
  vector<complex<long double> > ps(n);
  for (int i = 0; i < (n); i++) {
    long double x, y;
    cin >> x >> y;
    ps[i] = complex<long double>(x, y) - q;
  }
  sort(ps.begin(), ps.end(),
       [](complex<long double> a, complex<long double> b) {
         return abs(a) < abs(b);
       });
  long double ans = 1e100;
  for (int i = 0; i < (n + 1); i++) {
    vector<char> used(n);
    long double r1 = 0;
    if (i < n) {
      r1 = abs(ps[i] - p);
      for (int j = 0; j < (n); j++) {
        if (abs(ps[j] - p) <= r1 + eps) used[j] = true;
      }
    }
    long double r2 = 0;
    for (int j = 0; j < (n); j++) {
      if (!used[j]) r2 = abs(ps[j]);
    }
    chmin(ans, r1 * r1 + r2 * r2);
  }
  printf("%I64d\n", (long long)(ans + 0.5));
  return 0;
}
