#include <bits/stdc++.h>
using namespace std;
long long S(long long x) { return x * x; }
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  pair<long long, long long> pts[2];
  for (long long i = 0; i < 2; i++) {
    cin >> pts[i].first >> pts[i].second;
  }
  vector<pair<long long, long long> > v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  vector<long long> vect;
  vect.push_back(0);
  for (long long i = 0; i < n; i++) {
    vect.push_back(S(pts[0].first - v[i].first) +
                   S(pts[0].second - v[i].second));
  }
  long long ans = LLONG_MAX;
  for (long long i = 0; i < vect.size(); i++) {
    long long r1sq = vect[i], r2sq = 0;
    for (long long j = 0; j < n; j++) {
      if (S(pts[0].first - v[j].first) + S(pts[0].second - v[j].second) >
          r1sq) {
        r2sq = max(r2sq, S(pts[1].first - v[j].first) +
                             S(pts[1].second - v[j].second));
      }
    }
    ans = min(ans, r1sq + r2sq);
  }
  cout << ans << "\n";
  return 0;
}
