#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x7f7f7f7f7f7f7f7f;
long long distsqu(long long x1, long long y1, long long x2, long long y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
  long long n, x1, y1, x2, y2;
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> x1 >> y1 >> x2 >> y2;
  vector<pair<long long, long long> > flwrs;
  for (long long ii = 0; ii < n; ii++) {
    long long x, y;
    cin >> x >> y;
    long long dsq1 = distsqu(x1, y1, x, y), dsq2 = distsqu(x2, y2, x, y);
    flwrs.push_back(make_pair(dsq1, dsq2));
  }
  flwrs.push_back({0, 0});
  long long ans = INF;
  for (auto ii : flwrs) {
    long long d1 = ii.first;
    long long d2 = 0;
    for (auto jj : flwrs) {
      if (jj.first > d1) d2 = max(d2, jj.second);
    }
    ans = min(ans, d1 + d2);
  }
  cout << ans;
}
