#include <bits/stdc++.h>
using namespace std;
class Point {
 public:
  Point(const int& x = 0, const int& y = 0) : x_(x), y_(y) {}
  int x() const { return x_; }
  int y() const { return y_; }
  double SquaredDistanceToPoint(const Point& other) {
    return 1.0 * (x_ - other.x_) * (x_ - other.x_) +
           1.0 * (y_ - other.y_) * (y_ - other.y_);
  }

 private:
  int x_;
  int y_;
};
class SquaredDistanceComparator {
 public:
  SquaredDistanceComparator(const Point& point) : point_(point) {}
  bool operator()(const Point& p1, const Point& p2) {
    return point_.SquaredDistanceToPoint(p1) <
           point_.SquaredDistanceToPoint(p2);
  }

 private:
  Point point_;
};
int main() {
  ios_base::sync_with_stdio(false);
  int n, x1, y1, x2, y2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  Point f1(x1, y1);
  Point f2(x2, y2);
  vector<Point> flowers(n);
  for (int i = 0; i < n; ++i) {
    cin >> x1 >> y1;
    flowers[i] = Point(x1, y1);
  }
  SquaredDistanceComparator cmp(f1);
  sort(flowers.begin(), flowers.end(), cmp);
  double best_total_distance = 0;
  for (int i = n - 1; i >= -1; --i) {
    double dist_f1 = i >= 0 ? f1.SquaredDistanceToPoint(flowers[i]) : 0.0;
    double dist_f2 = 0.0;
    for (int j = i + 1; j < n; ++j) {
      dist_f2 = max(dist_f2, f2.SquaredDistanceToPoint(flowers[j]));
    }
    if (best_total_distance == 0 || dist_f1 + dist_f2 < best_total_distance) {
      best_total_distance = dist_f1 + dist_f2;
    }
  }
  cout << (long long)round(best_total_distance) << endl;
  return 0;
}
