#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const int maxn = 500500;
long long len(long long X1, long long Y1, long long X2, long long Y2) {
  return (X1 - X2) * (X1 - X2) + (Y1 - Y2) * (Y1 - Y2);
}
long long x[maxn], y[maxn];
int n;
void solve() {
  long long X1, Y1, X2, Y2, mx1, mx2, mn = 1000000000ll * 1000000000ll;
  scanf("%d", &n);
  scanf("%I64d %I64d %I64d %I64d", &X1, &Y1, &X2, &Y2);
  for (int i = 0; i < n; ++i) {
    scanf("%I64d %I64d", x + i, y + i);
  }
  for (int i = 0; i <= n; ++i) {
    mx1 = i < n ? len(X1, Y1, x[i], y[i]) : 0;
    mx2 = 0;
    for (int j = 0; j < n; ++j) {
      if (len(X1, Y1, x[j], y[j]) <= mx1) continue;
      if (len(X2, Y2, x[j], y[j]) > mx2) mx2 = len(X2, Y2, x[j], y[j]);
    }
    if (mx1 + mx2 < mn) mn = mx1 + mx2;
  }
  printf("%I64d", mn);
}
int main() {
  if (0) {
    freopen(
        "rare"
        ".in",
        "r", stdin);
    freopen(
        "rare"
        ".out",
        "w", stdout);
  }
  solve();
}
