#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x, y;
} a, b, c[2005];
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(void) {
  int n, i, j;
  long long t1, t2, ans = 1e18, x = 0;
  scanf("%d%lld%lld%lld%lld", &n, &a.x, &a.y, &b.x, &b.y);
  for (i = 1; i <= n; i++) scanf("%lld%lld", &c[i].x, &c[i].y);
  for (i = 0; i <= n; i++) {
    x = 0;
    t1 = dis(c[i], a);
    if (i == 0) t1 = 0;
    for (j = 1; j <= n; j++) {
      if (i == j) continue;
      long long tmp = dis(c[j], a);
      if (tmp <= t1) continue;
      x = max(dis(c[j], b), x);
    }
    ans = min(ans, x + t1);
  }
  printf("%lld\n", ans);
  return 0;
}
