import std.algorithm;
import std.bigint;
import std.concurrency;
import std.container;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.traits;
import std.typecons;


auto solve(long A, long B, long Q, long[] s, long[] t, long[] x) {
    const lWall = [long.min / 8, long.min / 8 + 1];
    const rWall = [long.max / 8 - 1, long.max / 8];

    auto shrines = assumeSorted(lWall ~ s ~ rWall);
    auto temples = assumeSorted(lWall ~ t ~ rWall);
    
    alias lShrine = (long pos) => shrines.lowerBound(pos).back;
    alias rShrine = (long pos) => shrines.upperBound(pos).front;
    alias lTemple = (long pos) => temples.lowerBound(pos).back;
    alias rTemple = (long pos) => temples.upperBound(pos).front;

    foreach (pos; x) {
        const ls = lShrine(pos);
        const lt = lTemple(pos);
        const rs = rShrine(pos);
        const rt = rTemple(pos);

        writeln(min(
            // ls -> llt
            pos - lTemple(ls),
            // lt -> lls
            pos - lShrine(lt),
            // ls -> rt
            pos + rt - 2 * ls,
            // lt -> rs
            pos + rs - 2 * lt,
            // rs -> rrt
            rTemple(rs) - pos,
            // rt -> rrs
            rShrine(rt) - pos,
            // rs -> lt
            2 * rs - lt - pos,
            // rt -> ls
            2 * rt - ls - pos
        ));
    }
}


void main() {
    auto input = stdin.byLine.map!split.joiner;

    long A;
    A = input.front.to!long;
    input.popFront;

    long B;
    B = input.front.to!long;
    input.popFront;

    long Q;
    Q = input.front.to!long;
    input.popFront;

    long[] s = new long[](cast(size_t) (A));
    foreach (i; 0 .. cast(size_t) (A)) {
        s[i] = input.front.to!long;
        input.popFront;
    }

    long[] t = new long[](cast(size_t) (B));
    foreach (i; 0 .. cast(size_t) (B)) {
        t[i] = input.front.to!long;
        input.popFront;
    }

    long[] x = new long[](cast(size_t) (Q));
    foreach (i; 0 .. cast(size_t) (Q)) {
        x[i] = input.front.to!long;
        input.popFront;
    }

    static if (is(ReturnType!solve == void))
        solve(A, B, Q, s, t, x);
    else
        solve(A, B, Q, s, t, x).writeln;
}
