#include <bits/stdc++.h>
using namespace std;
long long dist(long long a, long long b, long long x, long long y) {
  long long p1, p2;
  p1 = a - x;
  p2 = b - y;
  long long sol = (a - x) * (a - x) + (b - y) * (b - y);
  return sol;
}
struct distancias {
  long long f1;
  long long f2;
};
bool comp(struct distancias a, struct distancias b) { return (a.f1 > b.f1); }
bool comp2(struct distancias a, struct distancias b) { return (a.f2 > b.f2); }
int main() {
  long long n, x1, y1, x2, y2, x3, y3;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  long long r1, r2, a, b, cand, ant;
  vector<distancias> flores;
  distancias d;
  for (int i = 0; i < n; i++) {
    cin >> x3 >> y3;
    a = dist(x1, y1, x3, y3);
    b = dist(x2, y2, x3, y3);
    d.f1 = a;
    d.f2 = b;
    flores.push_back(d);
  }
  sort(flores.begin(), flores.end(), comp);
  cand = flores[0].f1;
  ant = 0;
  for (int i = 1; i < n; i++) {
    r1 = flores[i].f1;
    r2 = max(ant, flores[i - 1].f2);
    if (r1 + r2 < cand) {
      cand = r1 + r2;
    }
    ant = r2;
  }
  r2 = max(ant, flores[n - 1].f2);
  if (r2 < cand) {
    cand = r2;
  }
  cout << cand << endl;
}
