/*
TASK:dist
LANG:C++
*/

#include <cstdio>
#include <cmath>

using namespace std;

struct point
{
	long x;
	long y;
};

int n;
long x, y;
long min = 1500000;
point P[5000];
int used [5000] = {0};
int wrap [5000];

long dist (point p)
{
	return (long) sqrt((p.x-x)*(p.x-x)+(p.y-y)*(p.y-y));
}

int sq (int i, int j)
{
	if (P[j].x - P[i].x > 0 && P[j].y - P[i].y > 0) return 1;
	if (P[j].x - P[i].x < 0 && P[j].y - P[i].y > 0) return 2;
	if (P[j].x - P[i].x < 0 && P[j].y - P[i].y < 0) return 3;
	if (P[j].x - P[i].x > 0 && P[j].y - P[i].y < 0) return 4;
}

double tg (int i, int j)
{
	return ((double)(P[j].y - P[i].y) / (double)(P[j].x - P[i].y));
}

int isBetter (int cur, int i, int j)
{
	if (sq (cur, i) < sq (cur, j)) return 1;
	if (sq (cur, j) < sq (cur, i)) return 0;
	switch (sq(cur,i))
	{
	case 1:
	case 3:if (tg (cur, i) < tg (cur, j)) return 1; else return 0; break;
	case 2:
	case 4:if (tg (cur, i) > tg (cur, j)) return 1; else return 0; break;
	};
}

int main ()
{
	int i, m = 0;

	scanf ("%d %d %d ", &n, &x, &y);
	for (i = 0; i < n; i++)
	{
		scanf ("%d %d\n", &P[i].x, &P[i].y);
		if (P[i].y < P[m].y) m = i;
	}

	int cur, nxt, f = 1;
	double angl = 10;
	cur = m;
	used [m] = 1;
	wrap [0] = m;
	while (nxt != m)
	{
		nxt = 0;
		for (i = 1; i < n; i++)
			if (isBetter (cur, i, nxt))
				nxt = i;
		wrap[f++] = nxt;
		cur = nxt;
	}
	long d;
	for (i = 0; i < f; i++)
	{
		d = dist(P[wrap[i]]);
		if (d < min) min = d;
	}

	printf ("%d\n", min);
	return 0;
}
