#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, x1, y1, x2, y2, d1, d2, r1 = 10000000000000000,
                                             r2 = 10000000000000000, ans;
  ans = r2;
  r1 *= -1;
  r2 = r1;
  vector<pair<long long, pair<long long, long long> > > v1, v2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    d1 = (y1 - b) * (y1 - b) + (x1 - a) * (x1 - a);
    d2 = (y2 - b) * (y2 - b) + (x2 - a) * (x2 - a);
    v1.push_back(make_pair(d1, make_pair(a, b)));
    v2.push_back(make_pair(d2, make_pair(a, b)));
  }
  v1.push_back(make_pair(0, make_pair(x1, y1)));
  sort(v1.begin(), v1.end());
  for (int i = 0; i <= n; i++) {
    long long rad1 = v1[i].first, rad2 = 0, itr = 1;
    while (rad1 == v1[i + itr].first) itr++;
    for (int j = i + itr; j <= n; j++) {
      a = v1[j].second.first;
      b = v1[j].second.second;
      d2 = (y2 - b) * (y2 - b) + (x2 - a) * (x2 - a);
      rad2 = max(rad2, d2);
    }
    ans = min(rad1 + rad2, ans);
  }
  cout << ans << endl;
  return 0;
}
