#include <bits/stdc++.h>
using namespace std;
int size_n;
long long sx1, sy1, sx2, sy2;
long long result = 2e61;
vector<pair<long long, long long>> dist(0);
long long findDistance(long long x1, long long y1, long long x2, long long y2);
int main() {
  int ii, jj;
  long long tmpInputX, tmpInputY, cur1, cur2;
  cin >> size_n >> sx1 >> sy1 >> sx2 >> sy2;
  dist.resize(size_n + 1);
  for (ii = 0; ii < size_n; ii++) {
    cin >> tmpInputX >> tmpInputY;
    dist[ii].first = findDistance(tmpInputX, tmpInputY, sx1, sy1);
    dist[ii].second = findDistance(tmpInputX, tmpInputY, sx2, sy2);
  }
  dist[size_n] = make_pair(0, 0);
  for (ii = 0; ii <= size_n; ii++) {
    cur1 = 0;
    cur2 = dist[ii].second;
    for (jj = 0; jj <= size_n; jj++) {
      if (dist[jj].second > cur2) cur1 = max(cur1, dist[jj].first);
    }
    result = min(result, (cur1 + cur2));
  }
  cout << result << endl;
  return 0;
}
long long findDistance(long long x1, long long y1, long long x2, long long y2) {
  long long result, tmp1, tmp2;
  tmp1 = x1 - x2;
  tmp2 = y1 - y2;
  result = (tmp1 * tmp1) + (tmp2 * tmp2);
  return result;
}
