#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j;
  long long r1, r2, nr, ans, x1, x2, y1, y2, x[2002], y[2002];
  pair<long long, long long> p[2002];
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    p[i].first = (x1 - x[i]) * (x1 - x[i]) + (y1 - y[i]) * (y1 - y[i]);
    p[i].second = i;
  }
  sort(p, p + n);
  nr = 0;
  ans = p[n - 1].first;
  for (i = n - 1; i >= 0; --i) {
    j = p[i].second;
    r1 = p[i].first;
    r2 = nr;
    nr = max(nr, (x2 - x[j]) * (x2 - x[j]) + (y2 - y[j]) * (y2 - y[j]));
    ans = min(ans, r1 + r2);
  }
  ans = min(ans, nr);
  cout << ans;
  return 0;
}
