import bisect

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

INF = float('inf')

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

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

for q in range(Q):

    x = int(eval(input()))

    i = bisect.bisect_right(S,x)

    j = bisect.bisect_right(T,x)

    d = INF

    for s in [S[i-1],S[i]]:

        for t in [T[j-1],T[j]]:

            d1 = abs(s-x)+abs(s-t)

            d2 = abs(t-x)+abs(s-t)

            d = min(d,d1,d2)

    print(d)
import bisect

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

INF = float('inf')

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

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



ans = []

for q in range(Q):

    x = int(input())

    i = bisect.bisect_right(S,x)

    j = bisect.bisect_right(T,x)

    d = INF

    for s in [S[i-1],S[i]]:

        for t in [T[j-1],T[j]]:

            d1 = abs(x-s) + abs(s-t)

            d2 = abs(x-t) + abs(s-t)

            d = min(d,d1,d2)

    ans.append(d)

print(*ans,sep="\n")

import bisect

A, B, Q = list(map(int, input().split()))
INF = float("inf")
S = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
T = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
    x = int(eval(input()))
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    d = INF
    for s in [S[i - 1], S[i]]:
        for t in [T[j - 1], T[j]]:
            d1 = abs(s - x) + abs(s - t)
            d2 = abs(t - x) + abs(s - t)
            d = min(d, d1, d2)
    print(d)

import bisect

A, B, Q = map(int, input().split())
INF = float("inf")
S = [-INF] + [int(input()) for _ in range(A)] + [INF]
T = [-INF] + [int(input()) for _ in range(B)] + [INF]
ans = []
for q in range(Q):
    x = int(input())
    i = bisect.bisect_right(S, x)
    j = bisect.bisect_right(T, x)
    d = INF
    for s in [S[i - 1], S[i]]:
        for t in [T[j - 1], T[j]]:
            d1 = abs(x - s) + abs(s - t)
            d2 = abs(x - t) + abs(s - t)
            d = min(d, d1, d2)
    ans.append(d)
print(*ans, sep="\n")

-A, B, Q = list(map(int, input().split())) +A, B, Q = map(int, input().split()) -S = [-INF] + [int(eval(input())) for i in range(A)] + [INF] -T = [-INF] + [int(eval(input())) for i in range(B)] + [INF] +S = [-INF] + [int(input()) for _ in range(A)] + [INF] +T = [-INF] + [int(input()) for _ in range(B)] + [INF] +ans = [] -    x = int(eval(input())) +    x = int(input()) -            d1 = abs(s - x) + abs(s - t) -            d2 = abs(t - x) + abs(s - t) +            d1 = abs(x - s) + abs(s - t) +            d2 = abs(x - t) + abs(s - t) -    print(d) +    ans.append(d) +print(*ans, sep="\n")