#include <bits/stdc++.h>
using namespace std;
const long long int INF = 1e9 + 7;
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}
long long int sq(long long int x) { return x * x; }
void solve() {
  long long int n, x1, x2, y1, y2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  long long int ans = 8e18;
  vector<pair<long long int, long long int>> v(n);
  for (long long int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    v[i].first = sq(x - x1) + sq(y - y1);
    v[i].second = sq(x - x2) + sq(y - y2);
  }
  v.push_back({0, 0});
  for (auto i : v) {
    long long int r1 = i.first;
    long long int r2 = 0;
    for (auto j : v) {
      if (j.first > r1) {
        r2 = max(r2, j.second);
      }
    }
    ans = min(ans, r1 + r2);
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
}
