#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x, y;
} p[2010];
long long dis(node a, node b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
int main() {
  int n;
  node p1, p2;
  while (~scanf("%d%I64d%I64d%I64d%I64d", &n, &p1.x, &p1.y, &p2.x, &p2.y)) {
    for (int i = 0; i < n; i++) scanf("%I64d %I64d", &p[i].x, &p[i].y);
    p[n].x = p1.x, p[n].y = p1.y;
    long long r1, r2;
    long long ans = 0x3f3f3f3f3f3f3f3fLL;
    for (int i = 0; i < n + 1; i++) {
      r1 = dis(p1, p[i]);
      r2 = 0;
      for (int j = 0; j < n; j++) {
        if (i == j) continue;
        if (dis(p1, p[j]) > r1) r2 = max(r2, dis(p2, p[j]));
      }
      ans = min(ans, r1 + r2);
    }
    cout << ans << endl;
  }
  return 0;
}
