import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int x1 = in.nextInt();
        int y1 = in.nextInt();
        int x2 = in.nextInt();
        int y2 = in.nextInt();

        int[] x = new int[n];
        int[] y = new int[n];

        for (int i = 0; i < n; i++) {
            x[i] = in.nextInt();
            y[i] = in.nextInt();
        }

        long r1 = 0;
        long r2 = 0;
        long min_sum = Long.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            r1 = distance(x[i], y[i], x1, y1);
            r2 = 0;

            for (int j = 0; j < n; j++) {
                if (distance(x[j], y[j], x1, y1) > r1) {
                    r2 = Math.max(r2, distance(x[j], y[j], x2, y2));
                }
            }

            min_sum = Math.min(min_sum, r1 + r2);
        }

        r2 = 0;
        for (int i = 0; i < n; i++) {
            r2 = Math.max(r2, distance(x[i], y[i], x2, y2));
        }
        min_sum = Math.min(min_sum, r2);

        System.out.println(min_sum);
    }

    private static long distance(int x1, int y1, int x2, int y2) {
        return (long)(x1 - x2) * (x1 - x2) + (long)(y1 - y2) * (y1 - y2);
    }
}