mod = 1000000007
eps = 10**-9
inf = 10**15


def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.buffer.readline

    A, B, Q = map(int, input().split())
    S = [-inf]
    for _ in range(A):
        S.append(int(input()))
    S.append(inf)
    T = [-inf]
    for _ in range(B):
        T.append(int(input()))
    T.append(inf)

    for _ in range(Q):
        x = int(input())
        i = bisect_left(S, x)
        j = bisect_left(T, x)
        ans = []
        ans.append(x - S[i-1] + abs(S[i-1] - T[j-1]))
        ans.append(x - S[i-1] + abs(S[i-1] - T[j]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i-1]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i]))
        ans.append(S[i] - x + abs(S[i] - T[j-1]))
        ans.append(S[i] - x + abs(S[i] - T[j]))
        ans.append(T[j] - x + abs(T[j] - S[i-1]))
        ans.append(T[j] - x + abs(T[j] - S[i]))
        print(min(ans))


if __name__ == '__main__':
    main() mod = 1000000007 mod 1000000007 eps = 10**-9 eps 10**-9 10 -9 inf = 10**15 inf 10**15 10 15 def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.buffer.readline

    A, B, Q = map(int, input().split())
    S = [-inf]
    for _ in range(A):
        S.append(int(input()))
    S.append(inf)
    T = [-inf]
    for _ in range(B):
        T.append(int(input()))
    T.append(inf)

    for _ in range(Q):
        x = int(input())
        i = bisect_left(S, x)
        j = bisect_left(T, x)
        ans = []
        ans.append(x - S[i-1] + abs(S[i-1] - T[j-1]))
        ans.append(x - S[i-1] + abs(S[i-1] - T[j]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i-1]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i]))
        ans.append(S[i] - x + abs(S[i] - T[j-1]))
        ans.append(S[i] - x + abs(S[i] - T[j]))
        ans.append(T[j] - x + abs(T[j] - S[i-1]))
        ans.append(T[j] - x + abs(T[j] - S[i]))
        print(min(ans)) main import sys sys from bisect import bisect_left input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q S = [-inf] S [-inf] -inf inf for _ in range(A):
        S.append(int(input()))
     _ range(A) range A S.append(int(input())) S.append S append int(input()) int input() input S.append(inf) S.append S append inf T = [-inf] T [-inf] -inf inf for _ in range(B):
        T.append(int(input()))
     _ range(B) range B T.append(int(input())) T.append T append int(input()) int input() input T.append(inf) T.append T append inf for _ in range(Q):
        x = int(input())
        i = bisect_left(S, x)
        j = bisect_left(T, x)
        ans = []
        ans.append(x - S[i-1] + abs(S[i-1] - T[j-1]))
        ans.append(x - S[i-1] + abs(S[i-1] - T[j]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i-1]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i]))
        ans.append(S[i] - x + abs(S[i] - T[j-1]))
        ans.append(S[i] - x + abs(S[i] - T[j]))
        ans.append(T[j] - x + abs(T[j] - S[i-1]))
        ans.append(T[j] - x + abs(T[j] - S[i]))
        print(min(ans)) _ range(Q) range Q x = int(input()) x int(input()) int input() input i = bisect_left(S, x) i bisect_left(S, x) bisect_left S x j = bisect_left(T, x) j bisect_left(T, x) bisect_left T x ans = [] ans [] ans.append(x - S[i-1] + abs(S[i-1] - T[j-1])) ans.append ans append x - S[i-1] + abs(S[i-1] - T[j-1]) x - S[i-1] x S[i-1] S i-1 i 1 abs(S[i-1] - T[j-1]) abs S[i-1] - T[j-1] S[i-1] S i-1 i 1 T[j-1] T j-1 j 1 ans.append(x - S[i-1] + abs(S[i-1] - T[j])) ans.append ans append x - S[i-1] + abs(S[i-1] - T[j]) x - S[i-1] x S[i-1] S i-1 i 1 abs(S[i-1] - T[j]) abs S[i-1] - T[j] S[i-1] S i-1 i 1 T[j] T j ans.append(x - T[j-1] + abs(T[j-1] - S[i-1])) ans.append ans append x - T[j-1] + abs(T[j-1] - S[i-1]) x - T[j-1] x T[j-1] T j-1 j 1 abs(T[j-1] - S[i-1]) abs T[j-1] - S[i-1] T[j-1] T j-1 j 1 S[i-1] S i-1 i 1 ans.append(x - T[j-1] + abs(T[j-1] - S[i])) ans.append ans append x - T[j-1] + abs(T[j-1] - S[i]) x - T[j-1] x T[j-1] T j-1 j 1 abs(T[j-1] - S[i]) abs T[j-1] - S[i] T[j-1] T j-1 j 1 S[i] S i ans.append(S[i] - x + abs(S[i] - T[j-1])) ans.append ans append S[i] - x + abs(S[i] - T[j-1]) S[i] - x S[i] S i x abs(S[i] - T[j-1]) abs S[i] - T[j-1] S[i] S i T[j-1] T j-1 j 1 ans.append(S[i] - x + abs(S[i] - T[j])) ans.append ans append S[i] - x + abs(S[i] - T[j]) S[i] - x S[i] S i x abs(S[i] - T[j]) abs S[i] - T[j] S[i] S i T[j] T j ans.append(T[j] - x + abs(T[j] - S[i-1])) ans.append ans append T[j] - x + abs(T[j] - S[i-1]) T[j] - x T[j] T j x abs(T[j] - S[i-1]) abs T[j] - S[i-1] T[j] T j S[i-1] S i-1 i 1 ans.append(T[j] - x + abs(T[j] - S[i])) ans.append ans append T[j] - x + abs(T[j] - S[i]) T[j] - x T[j] T j x abs(T[j] - S[i]) abs T[j] - S[i] T[j] T j S[i] S i print(min(ans)) print min(ans) min ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main mod = 1000000007 1000000007 mod def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.buffer.readline

    A, B, Q = map(int, input().split())
    S = [-inf]
    for _ in range(A):
        S.append(int(input()))
    S.append(inf)
    T = [-inf]
    for _ in range(B):
        T.append(int(input()))
    T.append(inf)

    for _ in range(Q):
        x = int(input())
        i = bisect_left(S, x)
        j = bisect_left(T, x)
        ans = []
        ans.append(x - S[i-1] + abs(S[i-1] - T[j-1]))
        ans.append(x - S[i-1] + abs(S[i-1] - T[j]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i-1]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i]))
        ans.append(S[i] - x + abs(S[i] - T[j-1]))
        ans.append(S[i] - x + abs(S[i] - T[j]))
        ans.append(T[j] - x + abs(T[j] - S[i-1]))
        ans.append(T[j] - x + abs(T[j] - S[i]))
        print(min(ans)) def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.buffer.readline

    A, B, Q = map(int, input().split())
    S = [-inf]
    for _ in range(A):
        S.append(int(input()))
    S.append(inf)
    T = [-inf]
    for _ in range(B):
        T.append(int(input()))
    T.append(inf)

    for _ in range(Q):
        x = int(input())
        i = bisect_left(S, x)
        j = bisect_left(T, x)
        ans = []
        ans.append(x - S[i-1] + abs(S[i-1] - T[j-1]))
        ans.append(x - S[i-1] + abs(S[i-1] - T[j]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i-1]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i]))
        ans.append(S[i] - x + abs(S[i] - T[j-1]))
        ans.append(S[i] - x + abs(S[i] - T[j]))
        ans.append(T[j] - x + abs(T[j] - S[i-1]))
        ans.append(T[j] - x + abs(T[j] - S[i]))
        print(min(ans)) main inf = 10**15 10**15 inf eps = 10**-9 10**-9 eps
mod = 1000000007
eps = 10**-9
inf = 10**15


def main():
    import sys
    from bisect import bisect_left
    input = sys.stdin.buffer.readline

    A, B, Q = map(int, input().split())
    S = [-inf]
    for _ in range(A):
        S.append(int(input()))
    S.append(inf)
    T = [-inf]
    for _ in range(B):
        T.append(int(input()))
    T.append(inf)

    for _ in range(Q):
        x = int(input())
        i = bisect_left(S, x)
        j = bisect_left(T, x)
        ans = []
        ans.append(x - S[i-1] + abs(S[i-1] - T[j-1]))
        ans.append(x - S[i-1] + abs(S[i-1] - T[j]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i-1]))
        ans.append(x - T[j-1] + abs(T[j-1] - S[i]))
        ans.append(S[i] - x + abs(S[i] - T[j-1]))
        ans.append(S[i] - x + abs(S[i] - T[j]))
        ans.append(T[j] - x + abs(T[j] - S[i-1]))
        ans.append(T[j] - x + abs(T[j] - S[i]))
        print(min(ans))


if __name__ == '__main__':
    main()
