from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = float('inf')
S = [-INF] + list(int(input()) for _ in range(A)) + [INF]
T = [-INF] + list(int(input()) for _ in range(B)) + [INF]
for _ in range(Q):
    x = int(input())
    i = bisect_right(S,x)
    j = 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)
 from bisect import bisect_right A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q INF = float('inf') INF float('inf') float 'inf' S = [-INF] + list(int(input()) for _ in range(A)) + [INF] S [-INF] + list(int(input()) for _ in range(A)) + [INF] [-INF] + list(int(input()) for _ in range(A)) [-INF] -INF INF list(int(input()) for _ in range(A)) list int(input()) int input() input [INF] INF T = [-INF] + list(int(input()) for _ in range(B)) + [INF] T [-INF] + list(int(input()) for _ in range(B)) + [INF] [-INF] + list(int(input()) for _ in range(B)) [-INF] -INF INF list(int(input()) for _ in range(B)) list int(input()) int input() input [INF] INF for _ in range(Q):
    x = int(input())
    i = bisect_right(S,x)
    j = 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) _ range(Q) range Q x = int(input()) x int(input()) int input() input i = bisect_right(S,x) i bisect_right(S,x) bisect_right S x j = bisect_right(T,x) j bisect_right(T,x) bisect_right T x d = INF 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)
     s [S[i-1], S[i]] S[i-1] S i-1 i 1 S[i] 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)
     t [T[j-1], T[j]] T[j-1] T j-1 j 1 T[j] T j d1 = abs(s-x) + abs(s-t) d1 abs(s-x) + abs(s-t) abs(s-x) abs s-x s x abs(s-t) abs s-t s t d2 = abs(t-x) + abs(s-t) d2 abs(t-x) + abs(s-t) abs(t-x) abs t-x t x abs(s-t) abs s-t s t d = min(d, d1, d2) d min(d, d1, d2) min d d1 d2 print(d) print d B, Q = map(int, input().split()) map(int, input().split()) B Q = map(int, input().split()) map(int, input().split()) Q S = [-INF] + list(int(input()) for _ in range(A)) + [INF] [-INF] + list(int(input()) for _ in range(A)) + [INF] S j = bisect_right(T,x) bisect_right(T,x) j d = min(d, d1, d2) min(d, d1, d2) d d2 = abs(t-x) + abs(s-t) abs(t-x) + abs(s-t) d2 i = bisect_right(S,x) bisect_right(S,x) i A, B, Q = map(int, input().split()) map(int, input().split()) A T = [-INF] + list(int(input()) for _ in range(B)) + [INF] [-INF] + list(int(input()) for _ in range(B)) + [INF] T INF = float('inf') float('inf') INF x = int(input()) int(input()) x d = INF INF d d1 = abs(s-x) + abs(s-t) abs(s-x) + abs(s-t) d1
from bisect import bisect_right
A, B, Q = map(int, input().split())
INF = float('inf')
S = [-INF] + list(int(input()) for _ in range(A)) + [INF]
T = [-INF] + list(int(input()) for _ in range(B)) + [INF]
for _ in range(Q):
    x = int(input())
    i = bisect_right(S,x)
    j = 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)

