#include <bits/stdc++.h>
using namespace std;
long long dist(long long x1, long long y1, long long x2, long long y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
int main() {
  int n, x1, x2, y1, y2, x, y;
  vector<long long> d1(n), d2(n);
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    d1[i] = dist(x1, y1, x, y);
    d2[i] = dist(x2, y2, x, y);
  }
  long long r1, r2, res = 2e16;
  for (int i = 0; i < n + 1; i++) {
    r1 = 0;
    if (i < n) r1 = d1[i];
    r2 = 0;
    for (int j = 0; j < n; j++) {
      if (d1[j] > r1 && d2[j] > r2) r2 = d2[j];
    }
    res = min(res, r1 + r2);
  }
  return cout << res, 0;
}
