#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e16;
struct node {
  long long x, y;
  long long dis1, dis2;
} flo[2100];
long long cul(node f, long long fx, long long fy) {
  long long x = f.x, y = f.y;
  long long ans;
  ans = (x - fx) * (x - fx) + (y - fy) * (y - fy);
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  long long x1, y1, x2, y2;
  scanf("%I64d%I64d%I64d%I64d", &x1, &y1, &x2, &y2);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", &flo[i].x, &flo[i].y);
    flo[i].dis1 = cul(flo[i], x1, y1);
    flo[i].dis2 = cul(flo[i], x2, y2);
  }
  long long ans = INF;
  for (int i = 1; i <= n; i++) {
    long long dis = 0;
    for (int j = 1; j <= n; j++) {
      if (flo[j].dis1 > flo[i].dis1)
        if (flo[j].dis2 > dis) {
          dis = flo[j].dis2;
        }
    }
    if (dis + flo[i].dis1 < ans) ans = dis + flo[i].dis1;
  }
  for (int i = 1; i <= n; i++) {
    long long dis = 0;
    for (int j = 1; j <= n; j++) {
      if (flo[j].dis2 > flo[i].dis2)
        if (flo[j].dis1 > dis) {
          dis = flo[j].dis1;
        }
    }
    if (dis + flo[i].dis2 < ans) ans = dis + flo[i].dis2;
  }
  printf("%I64d\n", ans);
  return 0;
}
