#include <bits/stdc++.h>
using namespace std;
const long long INF = (long long)1e18 + 7LL;
template <class X, class Y>
void minimize(X &x, const Y &y) {
  if (x > y) x = y;
}
template <class X, class Y>
void maximize(X &x, const Y &y) {
  if (x < y) x = y;
}
pair<int, int> a[2020], p, q;
int n;
long long dis(const pair<int, int> &a, const pair<int, int> &b) {
  return ((1LL * (a.first - b.first) * (a.first - b.first)) +
          (1LL * (a.second - b.second) * (a.second - b.second)));
}
void process(void) {
  scanf("%d%d%d%d%d", &n, &p.first, &p.second, &q.first, &q.second);
  for (int i = (1), _b = (n); i <= _b; i = i + 1)
    scanf("%d%d", &a[i].first, &a[i].second);
  long long res = 0;
  for (int i = (1), _b = (n); i <= _b; i = i + 1) maximize(res, dis(q, a[i]));
  for (int i = (1), _b = (n); i <= _b; i = i + 1) {
    long long tmp = 0;
    for (int j = (1), _b = (n); j <= _b; j = j + 1)
      if (dis(p, a[j]) > dis(p, a[i])) maximize(tmp, dis(q, a[j]));
    minimize(res, tmp + dis(p, a[i]));
  }
  cout << res << endl;
}
int main(void) {
  process();
  return 0;
}
