#include <bits/stdc++.h>
using namespace std;
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
long long sqr(int a) { return (long long)a * (long long)a; }
long long dist(pair<int, int> p, pair<int, int> q) {
  return sqr(p.first - q.first) + sqr(p.second - q.second);
}
int main() {
  int n, x1, y1, x2, y2;
  scanf("%d%d%d%d%d", &n, &x1, &y1, &x2, &y2);
  vector<pair<long long, pair<int, int> > > pts;
  for (int i = 0; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    pair<int, int> flower = make_pair(x, y);
    long long d = dist(flower, make_pair(x1, y1));
    pair<long long, pair<int, int> > p = make_pair(d, flower);
    pts.push_back(p);
  }
  sort((pts).begin(), (pts).end());
  long long ans = 0;
  for (int i = 0; i < ((int)(pts).size()); ++i) {
    ans = max(ans, dist(pts[i].second, make_pair(x2, y2)));
  }
  for (int i = 0; i < ((int)(pts).size()); ++i) {
    long long rad = pts[i].first;
    long long mrad = 0;
    for (int j = 0; j < ((int)(pts).size()); ++j) {
      long long d = dist(pts[j].second, make_pair(x1, y1));
      if (d > rad) {
        mrad = max(mrad, dist(pts[j].second, make_pair(x2, y2)));
      }
    }
    ans = min(ans, rad + mrad);
  }
  cout << ans << endl;
  return 0;
}
