#include <bits/stdc++.h>
using namespace std;
struct point {
  long long x, y;
};
long long n;
point p1, p2;
long long int dis(point a, point b) {
  long long int r = ((a.x - b.x) * (a.x - b.x)) + ((a.y - b.y) * (a.y - b.y));
  return r;
}
int main() {
  cin >> n >> p1.x >> p1.y >> p2.x >> p2.y;
  long long int r1 = 0, r2 = 0, ans = 1000000000000000000;
  vector<point> v;
  for (int i = 0; i < n; i++) {
    long long x, y;
    point p;
    cin >> x >> y;
    p.x = x;
    p.y = y;
    v.push_back(p);
  }
  v.push_back(p1);
  for (int i = 0; i < n + 1; i++) {
    r2 = 0;
    r1 = dis(v[i], p1);
    for (int j = 0; j < n + 1; j++) {
      if (dis(v[j], p2) > r2 && dis(v[j], p1) > r1) r2 = dis(v[j], p2);
    }
    if (ans > r2 + r1) ans = r2 + r1;
  }
  cout << ans;
  return 0;
}
