program checkf;

uses
    testlib, sysutils;

const
    maxn = 1000;

var
    i, n, jx, jy, px, py, ja, pa: longint;
    x, y: array [1..maxn] of longint;

begin
    n := inf.readlongint;
    for i := 1 to n do
    begin
        x[i] := inf.readlongint;
        y[i] := inf.readlongint;
    end;

    jx := ans.readlongint;
    jy := ans.readlongint;

    ja := 0;
    for i := 1 to n do
        ja := ja + abs(x[i] - jx) + abs(y[i] - jy);

    px := ouf.readlongint;
    py := ouf.readlongint;

    if abs(px) > 10000 then quit(_wa, '');
    if abs(py) > 10000 then quit(_wa, '');

    pa := 0;
    for i := 1 to n do
    begin
        if (px = x[i]) and (py = y[i]) then
            quit(_wa, 'capital coincides with city ' + inttostr(i));

        pa := pa + abs(x[i] - px) + abs(y[i] - py);
    end;

    if ja < pa then
        quit(_wa, 'not optimal - expected: ' + inttostr(ja) + ', found: ' + inttostr(pa));
    if ja > pa then
        quit(_fail, 'better than jury''s - expected: ' + inttostr(ja) + ', found: ' + inttostr(pa));

    quit(_ok, inttostr(ja));
end.