#include <bits/stdc++.h>
using namespace std;
long long minm(long long a, long long b) {
  if (a > b) return b;
  return a;
}
int main() {
  long long n, x1, y1, x2, y2, i, j, k, dist1[2555], dist2[2555], x[2555],
      y[2555];
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (i = 1; i <= n; i += 1) {
    cin >> x[i] >> y[i];
    dist1[i] = (x1 - x[i]) * (x1 - x[i]) + (y1 - y[i]) * (y1 - y[i]);
    dist2[i] = (x2 - x[i]) * (x2 - x[i]) + (y2 - y[i]) * (y2 - y[i]);
  }
  long long mx, tot, val, ans = 8e18;
  mx = 0;
  for (i = 1; i <= n; i += 1) {
    mx = 0;
    for (j = 1; j <= n; j += 1) {
      if (dist1[j] > dist1[i]) {
        if (dist2[j] > mx) mx = dist2[j];
      }
    }
    ans = minm(ans, mx + dist1[i]);
  }
  sort(dist2 + 1, dist2 + 1 + n);
  ans = minm(ans, dist2[n]);
  cout << ans;
  return 0;
}
