A, B, Q = list(map(int, input().split()))

INF = 10 ** 18

S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]

T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]

X = [int(eval(input())) for _ in range(Q)]





def binary_search(q, A):

    l, r = 0, len(A)

    while r - l > 1:

        mid = (l + r) // 2

        if q > A[mid]:

            l = mid

        else:

            r = mid

    return A[l], A[r]





def main():

    for x in X:

        s1, s2 = binary_search(x, S)

        t1, t2 = binary_search(x, T)

        print((min(abs(s-t) + min(abs(s-x), abs(t-x)) for s in [s1, s2] for t in [t1, t2])))

    return



if __name__ == '__main__':

    main()

import sys

import bisect



A, B, Q = list(map(int, sys.stdin.readline().split()))

INF = 10 ** 18

S = [-INF] + [int(sys.stdin.readline()) for _ in range(A)] + [INF]

T = [-INF] + [int(sys.stdin.readline()) for _ in range(B)] + [INF]

X = [int(sys.stdin.readline()) for _ in range(Q)]





# def binary_search(q, A):

#     l, r = 0, len(A)

#     while r - l > 1:

#         mid = (l + r) // 2

#         if q > A[mid]:

#             l = mid

#         else:

#             r = mid

#     return A[l], A[r]





def main():

    for x in X:

        ids, idt = bisect.bisect_right(S, x), bisect.bisect_right(T, x)

        print((min(abs(s-t) + min(abs(s-x), abs(t-x)) for s in S[ids-1:ids+1] for t in T[idt-1:idt+1])))

    return



if __name__ == '__main__':

    main()

A, B, Q = list(map(int, input().split()))
INF = 10**18
S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF]
X = [int(eval(input())) for _ in range(Q)]


def binary_search(q, A):
    l, r = 0, len(A)
    while r - l > 1:
        mid = (l + r) // 2
        if q > A[mid]:
            l = mid
        else:
            r = mid
    return A[l], A[r]


def main():
    for x in X:
        s1, s2 = binary_search(x, S)
        t1, t2 = binary_search(x, T)
        print(
            (
                min(
                    abs(s - t) + min(abs(s - x), abs(t - x))
                    for s in [s1, s2]
                    for t in [t1, t2]
                )
            )
        )
    return


if __name__ == "__main__":
    main()

import sys
import bisect

A, B, Q = list(map(int, sys.stdin.readline().split()))
INF = 10**18
S = [-INF] + [int(sys.stdin.readline()) for _ in range(A)] + [INF]
T = [-INF] + [int(sys.stdin.readline()) for _ in range(B)] + [INF]
X = [int(sys.stdin.readline()) for _ in range(Q)]
# def binary_search(q, A):
#     l, r = 0, len(A)
#     while r - l > 1:
#         mid = (l + r) // 2
#         if q > A[mid]:
#             l = mid
#         else:
#             r = mid
#     return A[l], A[r]
def main():
    for x in X:
        ids, idt = bisect.bisect_right(S, x), bisect.bisect_right(T, x)
        print(
            (
                min(
                    abs(s - t) + min(abs(s - x), abs(t - x))
                    for s in S[ids - 1 : ids + 1]
                    for t in T[idt - 1 : idt + 1]
                )
            )
        )
    return


if __name__ == "__main__":
    main()

-A, B, Q = list(map(int, input().split())) +import sys +import bisect + +A, B, Q = list(map(int, sys.stdin.readline().split())) -S = [-INF] + [int(eval(input())) for _ in range(A)] + [INF] -T = [-INF] + [int(eval(input())) for _ in range(B)] + [INF] -X = [int(eval(input())) for _ in range(Q)] - - -def binary_search(q, A): -    l, r = 0, len(A) -    while r - l > 1: -        mid = (l + r) // 2 -        if q > A[mid]: -            l = mid -        else: -            r = mid -    return A[l], A[r] - - +S = [-INF] + [int(sys.stdin.readline()) for _ in range(A)] + [INF] +T = [-INF] + [int(sys.stdin.readline()) for _ in range(B)] + [INF] +X = [int(sys.stdin.readline()) for _ in range(Q)] +# def binary_search(q, A): +#     l, r = 0, len(A) +#     while r - l > 1: +#         mid = (l + r) // 2 +#         if q > A[mid]: +#             l = mid +#         else: +#             r = mid +#     return A[l], A[r] -        s1, s2 = binary_search(x, S) -        t1, t2 = binary_search(x, T) +        ids, idt = bisect.bisect_right(S, x), bisect.bisect_right(T, x) -                    for s in [s1, s2] -                    for t in [t1, t2] +                    for s in S[ids - 1 : ids + 1] +                    for t in T[idt - 1 : idt + 1]