#include <bits/stdc++.h>
using namespace std;
long long n, x1, x2, sdfsdfsdf, y2, x, y, ans = 1000000000000000000, r1, r2;
pair<long long, long long> dis[(int)(2e5 + 10)];
int main() {
  cin >> n >> x1 >> sdfsdfsdf >> x2 >> y2;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    dis[i].first = ((x1 - x) * (x1 - x)) + ((sdfsdfsdf - y) * (sdfsdfsdf - y));
    dis[i].second = ((x2 - x) * (x2 - x)) + ((y2 - y) * (y2 - y));
  }
  dis[0].first = dis[0].second = 0;
  for (int i = 0; i <= n; i++) {
    r1 = dis[i].first;
    r2 = 0;
    for (int j = 0; j <= n; j++)
      if (dis[j].first > r1) r2 = max(dis[j].second, r2);
    ans = min(ans, r1 + r2);
  }
  cout << ans << '\n';
}
