import std.stdio, std.conv;
import std.string;
import std.algorithm, std.container.rbtree;

void main()
{
    auto buf = readln.chomp.split.to!(size_t[]);
    immutable
        as = buf[0],
        bs = buf[1],
        qs = buf[2];
    auto
        a = as.readArray.redBlackTree,
        b = bs.readArray.redBlackTree,
        q = qs.readArray;
    foreach (dummy; [-100_0000_0000, +200_0000_0001])
    {
        a.insert(dummy);
        b.insert(dummy);
    }
    foreach (query; q)
    {
        auto
            ar = a.upperBound(query).front,
            al = a.lowerBound(query).back,
            br = b.upperBound(query).front,
            bl = b.lowerBound(query).back;
        debug stderr.writefln("%d:%d:%d %d:%d:%d",
                al, query, ar, bl, query, br);
        auto
            ll = query - al.min(bl),
            rr = ar.max(br) - query,
            rl = (ar < br) ?
                ((ar - query) + ar - bl) :
                ((br - query) + br - al),
            lr = (al < bl) ?
                ((query - bl) + (ar - bl)) :
                ((query - al) + (br - al));
        debug stderr.writefln("<<%d >>%d ><%d <>%d",
                ll, rr, rl, lr);
        ll.min(rr).min(rl).min(lr).writeln;
    }
}

long[] readArray(in size_t n)
{
    auto ret = new long[n];
    foreach (ref elem; ret)
        elem = readln.chomp.to!long;
    return ret;
}
