#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  pair<long long, long long> arr[n + 1];
  for (long long i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    arr[i] = make_pair(x, y);
  }
  arr[0] = make_pair(a, b);
  long long ans = 1e18;
  for (long long i = 0; i <= n; i++) {
    long long x = arr[i].first;
    long long y = arr[i].second;
    long long dis = (x - a) * (x - a) + (y - b) * (y - b);
    long long r2 = 0;
    for (long long j = 1; j <= n; j++) {
      x = arr[j].first;
      y = arr[j].second;
      long long d2 = (x - a) * (x - a) + (y - b) * (y - b);
      if (d2 > dis) {
        r2 = max(r2, (x - c) * (x - c) + (y - d) * (y - d));
      }
    }
    ans = min(ans, dis + r2);
  }
  cout << ans;
  return 0;
}
