#include <bits/stdc++.h>
using namespace std;
template <typename T>
constexpr string_view gtype() {
  string_view s = __PRETTY_FUNCTION__;
  return string_view(s.data() + 45, s.find(';', 45) - 45);
}
const int MAXN = 1e5;
const double eps = 1e-7;
const int MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n, x1, x2, y1, y2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  vector<pair<long long, long long>> points(n);
  long long mxr2 = 0;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    long long r1 = (x - x1) * (x - x1) + (y - y1) * (y - y1);
    long long r2 = (x - x2) * (x - x2) + (y - y2) * (y - y2);
    points[i] = {r1, r2};
    mxr2 = max(r2, mxr2);
  }
  sort(((points).begin()), ((points).end()));
  long long ans = 1e18;
  for (int i = 0; i < n; i++) {
    long long r1 = points[i].first;
    long long r2 = 0;
    for (int j = i + 1; j < n; j++) {
      r2 = max(r2, points[j].second);
    }
    ans = min(ans, r1 + r2);
  }
  cout << min(ans, mxr2) << endl;
  return 0;
}
