#include <bits/stdc++.h>
struct ma {
  long long r1;
  long long r2;
} ss[3000];
int main() {
  int n;
  long long x1, x2, x, y1, y2, y, r1, r2;
  while (scanf("%d%I64d%I64d%I64d%I64d", &n, &x1, &y1, &x2, &y2) != EOF) {
    for (int i = 0; i < n; i++) {
      scanf("%I64d%I64d", &x, &y);
      long long a = (x - x1) * (x - x1) + (y - y1) * (y - y1);
      long long b = (x - x2) * (x - x2) + (y - y2) * (y - y2);
      ss[i].r1 = a;
      ss[i].r2 = b;
    }
    ss[n].r1 = 0;
    ss[n].r2 = 0;
    long long sum, k, ma;
    for (int i = 0; i <= n; i++) {
      k = ss[i].r1;
      ma = 0;
      for (int j = 0; j <= n; j++) {
        if (ss[j].r1 > k && ss[j].r2 > ma) ma = ss[j].r2;
      }
      if (i == 0 || (sum > (k + ma))) sum = k + ma;
    }
    printf("%I64d\n", sum);
  }
  return 0;
}
