#include <bits/stdc++.h>
using namespace std;
long long distance(long long x1, long long y1, long long x2, long long y2) {
  return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
}
int main() {
  long long x1, x2, y1, y2, i, a[2005], b[2005], n,
      f1 = 1, f2 = 1, ans = 0, x = 0, y = 0, dist = 0, j, temp;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  for (i = 1; i <= n; i++) {
    dist = distance(x1, y1, a[i], b[i]);
    f1 = 1;
    y = max(y, distance(x2, y2, a[i], b[i]));
    for (j = 1; j <= n; j++) {
      if (distance(x1, y1, a[j], b[j]) > dist) {
        temp = distance(x2, y2, a[j], b[j]);
        if (f1)
          x = temp, f1 = 0;
        else
          x = max(x, temp);
      }
    }
    if (f1) {
      if (f2)
        ans = dist, f2 = 0;
      else
        ans = min(ans, dist);
    } else {
      if (f2)
        ans = x + dist, f2 = 0;
      else
        ans = min(ans, x + dist);
    }
  }
  ans = min(ans, y);
  cout << ans << "\n";
  return 0;
}
