#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T b, T p, T m) {
  T ret;
  if (p == 0) return 1;
  if (p & 1) {
    ret = (bigmod(b, p / 2, m) % m);
    return ((b % m) * ret * ret) % m;
  } else {
    ret = (bigmod(b, p / 2, m) % m);
    return (ret * ret) % m;
  }
}
int dx4[] = {1, -1, 0, 0};
int dy4[] = {0, 0, 1, -1};
int dx6[] = {0, 0, 1, -1, 0, 0};
int dy6[] = {1, -1, 0, 0, 0, 0};
int dz6[] = {0, 0, 0, 0, 1, -1};
int dx8[] = {1, -1, 0, 0, -1, 1, -1, 1};
int dy8[] = {0, 0, 1, -1, 1, 1, -1, -1};
int dkx8[] = {-1, 1, -1, 1, -2, -2, 2, 2};
int dky8[] = {2, 2, -2, -2, 1, -1, 1, -1};
int tc = 1;
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long int mx = 2000;
const long long int mod = 1000000007;
long long a[mx + 5], r1[mx + 5], r2[mx + 5];
long long calc(long long a, long long b, long long c, long long d) {
  long long X = abs(a - c);
  long long Y = abs(b - d);
  return X * X + Y * Y;
}
int main() {
  long long i, j, n, x1, y1, x2, y2, x, y, ans, maxr1, maxr2;
  while (cin >> n >> x1 >> y1 >> x2 >> y2) {
    maxr1 = maxr2 = 0;
    for (i = 0; i < n; i++) {
      scanf("%lld %lld", &x, &y);
      r1[i] = calc(x, y, x1, y1);
      r2[i] = calc(x, y, x2, y2);
      maxr1 = max(maxr1, r1[i]);
      maxr2 = max(maxr2, r2[i]);
    }
    ans = min(maxr1, maxr2);
    for (i = 0; i < n; i++) {
      maxr1 = r1[i];
      maxr2 = 0;
      for (j = 0; j < n; j++) {
        if (r1[j] > maxr1) maxr2 = max(maxr2, r2[j]);
      }
      ans = min(ans, maxr1 + maxr2);
    }
    cout << ans << "\n";
  }
  return 0;
}
