#include <bits/stdc++.h>
using namespace std;
struct node {
  long long r1, r2;
} p[2005];
bool cmp(node a, node b) { return a.r1 > b.r1; }
bool cmp1(node a, node b) { return a.r2 > b.r2; }
int main() {
  int i, n, j;
  long long x1, x2, y1, y2, a[2005], b[2005];
  long long ans1, ans2, mm, mi, r;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (i = 0; i < n; i++) {
    p[i].r1 = (a[i] - x1) * (a[i] - x1) + (b[i] - y1) * (b[i] - y1);
    p[i].r2 = (a[i] - x2) * (a[i] - x2) + (b[i] - y2) * (b[i] - y2);
  }
  sort(p, p + n, cmp);
  ans1 = ans2 = 9223372036854775807;
  for (i = 0; i < n; i++) {
    mi = 0;
    for (j = 0; j < i; j++)
      if (mi < p[j].r2) mi = p[j].r2;
    if (ans1 > p[i].r1 + mi) ans1 = mi + p[i].r1;
  }
  sort(p, p + n, cmp1);
  for (i = 0; i < n; i++) {
    mm = 0;
    for (j = 0; j < i; j++)
      if (mm < p[j].r1) mm = p[j].r1;
    if (ans1 > p[i].r2 + mm) ans2 = mm + p[i].r2;
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}
