#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e16;
const long long MB = 20;
const long long MOD = 998244353;
const long long maxN = 1e7 + 1;
long long getDis(pair<long long, long long>& one,
                 pair<long long, long long>& two) {
  return (one.first - two.first) * (one.first - two.first) +
         (one.second - two.second) * (one.second - two.second);
}
void solve() {
  long long n;
  pair<long long, long long> one, two;
  cin >> n >> one.first >> one.second >> two.first >> two.second;
  vector<pair<long long, long long>> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  long long ans = INF;
  for (long long i = 0; i < n; i++) {
    long long r1 = getDis(one, a[i]);
    long long r2 = 0;
    for (long long j = 0; j < n; j++) {
      if (getDis(one, a[j]) <= r1) continue;
      r2 = max(r2, getDis(two, a[j]));
    }
    ans = min(ans, r1 + r2);
  }
  long long r2 = 0;
  for (long long i = 0; i < n; i++) {
    r2 = max(r2, getDis(two, a[i]));
  }
  ans = min(ans, (long long)r2);
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout << fixed;
  cout.precision(12);
  srand(time(0));
  long long t = 1;
  while (t--) solve();
}
