#include <bits/stdc++.h>
using namespace std;
int n;
int x1, z1;
int x2, z2;
pair<long long, long long> p[2050];
int main() {
  scanf("%d%d%d%d%d", &n, &x1, &z1, &x2, &z2);
  for (int i = 0; i < n; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    long long dist1 = 1ll * (x1 - a) * (x1 - a) + 1ll * (z1 - b) * (z1 - b),
              dist2 = 1ll * (x2 - a) * (x2 - a) + 1ll * (z2 - b) * (z2 - b);
    p[i].first = dist1;
    p[i].second = dist2;
  }
  p[n].first = 0;
  p[n].second = 0;
  ++n;
  long long res = 1e18;
  for (int i = 0; i < n; ++i) {
    long long r1 = p[i].first, r2 = 0;
    for (int j = 0; j < n; ++j) {
      if (p[j].first > r1) {
        r2 = max(r2, p[j].second);
      }
    }
    res = min(res, r1 + r2);
  }
  printf("%I64d", res);
  return 0;
}
