#include <bits/stdc++.h>
using namespace std;
const long long LINF = (long long)1e18;
const int INF = (int)1e9 + 7;
const int N = (int)4e5 + 1;
const double EPS = (double)1e-9;
const double PI = (double)3.14159265359;
const int MODULO[6] = {INF,        1000019677, 1000019393,
                       1000007521, 1000024073, 1000009667};
const int PF[5] = {77, 31, 98, 45, 67};
const int nx[4] = {0, 0, 1, -1};
const int ny[4] = {1, -1, 0, 0};
inline bool eq(const long double &a, const long double &b) {
  return fabs(a - b) < EPS;
}
int n;
pair<int, int> fi, se;
pair<int, int> p[N];
pair<long long, long long> di[N];
long long dist(pair<int, int> x, pair<int, int> y) {
  return (x.first - y.first) * 1LL * (x.first - y.first) +
         (x.second - y.second) * 1LL * (x.second - y.second);
}
int main() {
  scanf("%d%d%d%d%d", &n, &fi.first, &fi.second, &se.first, &se.second);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &p[i].first, &p[i].second);
    di[i] = make_pair(dist(p[i], fi), dist(p[i], se));
  }
  long long ans = LINF;
  for (int i = 1; i <= n; i++) {
    long long res = 0ll;
    for (int j = 1; j <= n; j++) {
      if (di[j].second > di[i].second) res = max(res, di[j].first);
    }
    ans = min(ans, res + di[i].second);
  }
  for (int i = 1; i <= n; i++) {
    long long res = 0ll;
    for (int j = 1; j <= n; j++) {
      if (di[j].first > di[i].first) res = max(res, di[j].second);
    }
    ans = min(ans, res + di[i].first);
  }
  printf("%I64d", ans);
  return 0;
}
