#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long first[n];
  long long second[n];
  long long r1, r2;
  r1 = 0;
  r2 = 0;
  long long ans = 0;
  long long x1, y1, x2, y2, x, y;
  scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);
  for (int i = 0; i < n; i++) {
    scanf("%lld%lld", &x, &y);
    first[i] = (x - x1) * (x - x1) + (y - y1) * (y - y1);
    second[i] = (x - x2) * (x - x2) + (y - y2) * (y - y2);
    ans = ((ans) > (second[i]) ? (ans) : (second[i]));
  }
  for (int i = 0; i < n; i++) {
    r1 = first[i];
    r2 = 0;
    for (int j = 0; j < n; j++) {
      if (first[j] > r1) {
        r2 = ((r2) > (second[j]) ? (r2) : (second[j]));
      }
    }
    ans = ((ans) < (r1 + r2) ? (ans) : (r1 + r2));
  }
  printf("%lld\n", ans);
  return 0;
}
