#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> p[2005];
int main() {
  long long n, x1, y1, x2, y2, x, y, ans = 10000000000000000;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    p[i] = make_pair((((x1 - x) * (x1 - x)) + ((y1 - y) * (y1 - y))),
                     (((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y))));
  }
  sort(p, p + n);
  long long mayortotal = 0;
  for (int j = 0; j < n; j++) {
    mayortotal = max(mayortotal, p[j].second);
  }
  for (int i = 0; i < n; i++) {
    long long mayor = 0;
    for (int j = i + 1; j < n; j++) {
      if (p[j].first == p[i].first)
        continue;
      else
        mayor = max(mayor, p[j].second);
    }
    ans = min(ans, p[i].first + mayor);
  }
  cout << min(ans, mayortotal) << endl;
  return 0;
}
