#include <bits/stdc++.h>
using namespace std;
using uint = unsigned;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
template <typename T>
using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
using minheap = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1e9 + 10;
const ll LLINF = 1e18 + 10;
const int dx[] = {-1, 0, 1, 0, -1, 1, 1, -1};
const int dy[] = {0, -1, 0, 1, -1, -1, 1, 1};
template <typename T>
inline T sq(T x) {
  return x * x;
}
template <typename T, typename U>
inline bool chmax(T &x, U y) {
  if (x >= y) return false;
  x = y;
  return true;
}
template <typename T, typename U>
inline bool chmin(T &x, U y) {
  if (x <= y) return false;
  x = y;
  return true;
}
template <typename T>
inline T &sort(T &c) {
  sort(begin(c), end(c));
  return c;
}
template <typename T>
inline T &reverse(T &c) {
  reverse(begin(c), end(c));
  return c;
}
template <typename T>
inline T &unique(T &c) {
  sort(begin(c), end(c));
  c.erase(unique(begin(c), end(c)), end(c));
  return c;
}
template <typename T>
inline T sorted(const T &c) {
  T d = c;
  return move(sort(d));
}
template <typename T>
inline T reversed(const T &c) {
  T d = c;
  return move(reverse(d));
}
template <typename T>
inline T uniqued(const T &c) {
  T d = c;
  return move(unique(d));
}
ll modpow(ll x, ll e, ll mod = 1000000007) {
  ll res = 1;
  e %= mod - 1;
  while (e) {
    if (e & 1) res = res * x;
    x = x * x;
    e >>= 1;
  }
  return res;
}
inline ll in() {
  ll x;
  scanf("%lld", &x);
  return x;
}
pair<ll, ll> rot45(ll x, ll y) { return make_pair(x + y, x - y); }
pair<ll, ll> rot45inv(ll u, ll v) {
  return make_pair((u + v) / 2, (u - v) / 2);
}
template <typename T>
void dump(T x) {}
template <typename T, size_t N>
struct print_tuple {
  static void print(const T &t, ostream &os) {
    print_tuple<T, N - 1>::print(t, os);
    os << " " << get<N - 1>(t);
  }
};
template <typename T>
struct print_tuple<T, 1> {
  static void print(const T &t, ostream &os) { os << get<0>(t); }
};
namespace std {
template <typename... Ts>
ostream &operator<<(ostream &os, const tuple<Ts...> &t) {
  print_tuple<tuple<Ts...>, tuple_size<tuple<Ts...>>::value>::print(t, os);
}
}  // namespace std
int n;
ll x1, y98107324897, x2, y89107324891;
ll x[2010], y[2010];
ll dist(ll x1, ll y98107324897, ll x2, ll y89107324891) {
  return sq(x1 - x2) + sq(y98107324897 - y89107324891);
}
int main() {
  cin >> n >> x1 >> y98107324897 >> x2 >> y89107324891;
  for (ll i = (0); i < (ll)(n); i += 1) cin >> x[i] >> y[i];
  x[n] = x1;
  y[n] = y98107324897;
  n++;
  ll res = 1e18;
  for (ll i = (0); i < (ll)(n); i += 1) {
    ll r1 = dist(x1, y98107324897, x[i], y[i]), r2 = 0;
    for (ll j = (0); j < (ll)(n); j += 1) {
      ll d1 = dist(x1, y98107324897, x[j], y[j]);
      ll d2 = dist(x2, y89107324891, x[j], y[j]);
      if (d1 > r1) chmax(r2, d2);
    }
    chmin(res, r1 + r2);
  }
  cout << res << endl;
}
