#include <bits/stdc++.h>
using namespace std;
long long n, xx, yy, xxx, yyy;
long long x[2010], y[2010];
long long disf[2010], diss[2010];
long long mnm;
int part(int s, int e) {
  int i = 1;
  int j = e - 1;
  while (i < j)
    if (disf[i] <= disf[e])
      i++;
    else if (disf[j] >= disf[e])
      j--;
    else {
      swap(disf[i], disf[j]);
      swap(diss[i], diss[j]);
    }
  if (disf[i] < disf[e]) {
    swap(disf[i + 1], disf[e]);
    swap(diss[i + 1], diss[e]);
    return i + 1;
  } else {
    swap(disf[i], disf[e]);
    swap(diss[i], diss[e]);
    return i;
  }
}
void qsd1(int s, int e) {
  if (s < e) {
    int m = part(s, e);
    qsd1(s, m - 1);
    qsd1(m + 1, e);
  }
}
long long fnd(int k) {
  long long mxm = 0;
  for (int i = k; i < n; i++)
    if (mxm < diss[i]) mxm = diss[i];
  cerr << endl << "find  fnd(" << k << ")=" << mxm;
  return mxm;
}
int main() {
  cin >> n >> xx >> yy >> xxx >> yyy;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    disf[i] = (x[i] - xx) * (x[i] - xx) + (y[i] - yy) * (y[i] - yy);
    diss[i] = (x[i] - xxx) * (x[i] - xxx) + (y[i] - yyy) * (y[i] - yyy);
  }
  qsd1(0, n - 1);
  mnm = fnd(0);
  for (int i = 1; i <= n; i++)
    if (mnm > (disf[i - 1] + fnd(i))) mnm = disf[i - 1] + fnd(i);
  cout << mnm;
}
