#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long, long long> v[2010];
long long r1, r2, ans = 0x3F3F3F3F3F3F3F3FLL;
long long dist(long long x, long long y) { return x * x + y * y; }
int main() {
  long long x1, y1, x2, y2;
  scanf("%d %lld %lld %lld %lld", &n, &x1, &y1, &x2, &y2);
  for (int i = 0; i < n; ++i) {
    scanf("%lld %lld", &v[i].first, &v[i].second);
  }
  long long aux = 0;
  for (int i = 0; i < n; ++i) {
    long long x = v[i].first;
    long long y = v[i].second;
    aux = dist(x - x1, y - y1);
    long long aux2 = 0;
    for (int i = 0; i < n; ++i) {
      long long xx = v[i].first;
      long long yy = v[i].second;
      if (dist(xx - x1, yy - y1) > aux) {
        aux2 = max(aux2, dist(xx - x2, yy - y2));
      }
    }
    ans = min(ans, aux + aux2);
  }
  for (int i = 0; i < n; ++i) {
    long long x = v[i].first;
    long long y = v[i].second;
    aux = dist(x - x2, y - y2);
    long long aux2 = 0;
    for (int i = 0; i < n; ++i) {
      long long xx = v[i].first;
      long long yy = v[i].second;
      if (dist(xx - x2, yy - y2) > aux) {
        aux2 = max(aux2, dist(xx - x1, yy - y1));
      }
    }
    ans = min(ans, aux + aux2);
  }
  printf("%lld\n", ans);
  return 0;
}
