#include <bits/stdc++.h>
using namespace std;
long long d(long long a, long long b, long long c, long long e) {
  return (a - c) * (a - c) + (b - e) * (b - e);
}
int main() {
  int N;
  cin >> N;
  long long X1, Y1, X2, Y2;
  cin >> X1 >> Y1 >> X2 >> Y2;
  vector<pair<long long, long long> > v;
  for (int i = 0; i < N; ++i) {
    long long x, y;
    cin >> x >> y;
    long long d1 = d(X1, Y1, x, y);
    long long d2 = d(X2, Y2, x, y);
    v.push_back({d1, d2});
  }
  sort(v.begin(), v.end());
  long long res = 1e18;
  for (int i = 0; i < N; ++i) {
    long long l = v[i].first;
    long long r = 0;
    for (int j = i + 1; j < N; ++j) r = max(r, v[j].second);
    res = min(res, l + r);
  }
  long long r = 0;
  for (int i = 0; i < N; ++i) r = max(r, v[i].second);
  res = min(res, r);
  cout << res;
}
