void main()
{
    long[] tmp = rdRow;
    long a = tmp[0], b = tmp[1], q = tmp[2];
    long[] s = a.rdCol;
    long[] t = b.rdCol;
    long[] x = q.rdCol;

    foreach (y; x)
    {
        long result = 1L << 60;
        long su, sl, tu, tl;

        su = s.binSrch!"a > b"(y);
        if (su != a)
        {
            tu = t.binSrch!"a > b"(s[su]);
            if (tu != b)
            {
                result = min(result, abs(y-s[su])+abs(s[su]-t[tu]));
            }
            tl = t.binSrch!"a < b"(s[su]);
            if (tl != -1)
            {
                result = min(result, abs(y-s[su])+abs(s[su]-t[tl]));
            }
        }

        sl = s.binSrch!"a < b"(y);
        if (sl != -1)
        {
            tu = t.binSrch!"a > b"(s[sl]);
            if (tu != b)
            {
                result = min(result, abs(y-s[sl])+abs(s[sl]-t[tu]));
            }
            tl = t.binSrch!"a < b"(s[sl]);
            if (tl != -1)
            {
                result = min(result, abs(y-s[sl])+abs(s[sl]-t[tl]));
            }
        }

        tu = t.binSrch!"a > b"(y);
        if (tu != b)
        {
            su = s.binSrch!"a > b"(t[tu]);
            if (su != a)
            {
                result = min(result, abs(y-t[tu])+abs(t[tu]-s[su]));
            }
            sl = s.binSrch!"a < b"(t[tu]);
            if (sl != -1)
            {
                result = min(result, abs(y-t[tu])+abs(t[tu]-s[sl]));
            }
        }

        tl = t.binSrch!"a < b"(y);
        if (tl != -1)
        {
            su = s.binSrch!"a > b"(t[tl]);
            if (su != a)
            {
                result = min(result, abs(y-t[tl])+abs(t[tl]-s[su]));
            }
            sl = s.binSrch!"a < b"(t[tl]);
            if (sl != -1)
            {
                result = min(result, abs(y-t[tl])+abs(t[tl]-s[sl]));
            }
        }

        result.writeln;
    }
}

long binSrch(alias pred = "a < b")(long[] arr, long val)
{
    alias predFun = binaryFun!pred;
    long l = -1, r = arr.length;
    if (!predFun(l, r)) swap(l, r);
    while (abs(r - l) > 1)
    {
        long m = (l + r) / 2;
        if (predFun(arr[m], val)) l = m;
        else r = m;
    }
    return l;
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow!T).array;
}

void wrMat(T = long)(T[][] mat)
{
    //import std.stdio : write, writeln;

    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;