#include <bits/stdc++.h>
using namespace std;
struct flower {
  long long dis1;
  long long dis2;
};
bool cmp1(flower a, flower b) {
  if (a.dis1 == b.dis1) {
    return b.dis2 > a.dis2;
  }
  return (a.dis1 < b.dis1);
}
int main() {
  int n;
  cin >> n;
  flower in[n];
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    in[i].dis1 = (abs(a - x) * abs(a - x) + abs(b - y) * abs(b - y));
    in[i].dis2 = (abs(c - x) * abs(c - x) + abs(d - y) * abs(d - y));
  }
  sort(in, in + n, cmp1);
  long long ans = 100000000000000000;
  long long maX = 0;
  for (int j = 0; j < n; j++) {
    maX = max(maX, in[j].dis2);
  }
  ans = maX;
  for (int i = 0; i < n; i++) {
    long long part = in[i].dis1;
    maX = 0;
    for (int j = i + 1; j < n; j++) {
      maX = max(maX, in[j].dis2);
    }
    ans = min(ans, part + maX);
  }
  cout << ans << endl;
  return 0;
}
