import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B, Q = mi()

S = [ii() for _ in range(A)]
T = [ii() for _ in range(B)]

S_ = [S[0]] + S + [S[A-1]]
T_ = [T[0]] + T + [T[B-1]]

for _ in range(Q):
    f = ii()
    to_s = bisect.bisect_left(S, f)
    to_t = bisect.bisect_left(T, f)

    ans = float('inf')

    for i in [S_[to_s], S_[to_s+1]]:
        for j in [T_[to_t], T_[to_t+1]]:
            tmp = min(abs(i - f), abs(j - f)) + abs(i - j)
            ans = min(ans, tmp)
    '''
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t+1]), float('inf'))
    ans = min(abs(S_[to_s+1] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t]), ans)
    ans = min(abs(S_[to_s+1] - T_[to_t]) + abs(f - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - T_[to_t]) + abs(f - T_[to_t]), ans)
    '''
    print(ans) import sys sys sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 def ii(): return int(sys.stdin.readline()) ii def mi(): return map(int, sys.stdin.readline().split()) mi def li(): return list(map(int, sys.stdin.readline().split())) li list(map(int, sys.stdin.readline().split())) for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] li2 N N [ini]*i for _ in range(j) for _ in range(j) _ range(j) range j for _ in range(j) [ini]*i [ini] ini i def dp2(ini, i, j): return [[ini]*i for _ in range(j)] dp2 ini ini i i j j import bisect bisect A, B, Q = mi() A mi() mi B Q ii() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) ii() ii S = [ii() for _ in range(A)] S [ii() for _ in range(A)] ii() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) ii() ii T = [ii() for _ in range(B)] T [ii() for _ in range(B)] S_ = [S[0]] + S + [S[A-1]] S_ [S[0]] + S + [S[A-1]] [S[0]] + S [S[0]] S[0] S 0 S [S[A-1]] S[A-1] S A-1 A 1 T_ = [T[0]] + T + [T[B-1]] T_ [T[0]] + T + [T[B-1]] [T[0]] + T [T[0]] T[0] T 0 T [T[B-1]] T[B-1] T B-1 B 1 for _ in range(Q):
    f = ii()
    to_s = bisect.bisect_left(S, f)
    to_t = bisect.bisect_left(T, f)

    ans = float('inf')

    for i in [S_[to_s], S_[to_s+1]]:
        for j in [T_[to_t], T_[to_t+1]]:
            tmp = min(abs(i - f), abs(j - f)) + abs(i - j)
            ans = min(ans, tmp)
    '''
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t+1]), float('inf'))
    ans = min(abs(S_[to_s+1] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t]), ans)
    ans = min(abs(S_[to_s+1] - T_[to_t]) + abs(f - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - T_[to_t]) + abs(f - T_[to_t]), ans)
    '''
    print(ans) _ range(Q) range Q f = ii() f ii() ii to_s = bisect.bisect_left(S, f) to_s bisect.bisect_left(S, f) bisect.bisect_left bisect bisect_left S f to_t = bisect.bisect_left(T, f) to_t bisect.bisect_left(T, f) bisect.bisect_left bisect bisect_left T f ans = float('inf') ans float('inf') float 'inf' for i in [S_[to_s], S_[to_s+1]]:
        for j in [T_[to_t], T_[to_t+1]]:
            tmp = min(abs(i - f), abs(j - f)) + abs(i - j)
            ans = min(ans, tmp)
     i [S_[to_s], S_[to_s+1]] S_[to_s] S_ to_s S_[to_s+1] S_ to_s+1 to_s 1 for j in [T_[to_t], T_[to_t+1]]:
            tmp = min(abs(i - f), abs(j - f)) + abs(i - j)
            ans = min(ans, tmp)
     j [T_[to_t], T_[to_t+1]] T_[to_t] T_ to_t T_[to_t+1] T_ to_t+1 to_t 1 tmp = min(abs(i - f), abs(j - f)) + abs(i - j) tmp min(abs(i - f), abs(j - f)) + abs(i - j) min(abs(i - f), abs(j - f)) min abs(i - f) abs i - f i f abs(j - f) abs j - f j f abs(i - j) abs i - j i j ans = min(ans, tmp) ans min(ans, tmp) min ans tmp '''
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t+1]), float('inf'))
    ans = min(abs(S_[to_s+1] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t]), ans)
    ans = min(abs(S_[to_s+1] - T_[to_t]) + abs(f - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - T_[to_t]) + abs(f - T_[to_t]), ans)
    ''' print(ans) print ans def li(): return list(map(int, sys.stdin.readline().split())) def li(): return list(map(int, sys.stdin.readline().split())) li ans = float('inf') float('inf') ans ans = min(ans, tmp) min(ans, tmp) ans B, Q = mi() mi() B S = [ii() for _ in range(A)] [ii() for _ in range(A)] S A, B, Q = mi() mi() A to_s = bisect.bisect_left(S, f) bisect.bisect_left(S, f) to_s def mi(): return map(int, sys.stdin.readline().split()) def mi(): return map(int, sys.stdin.readline().split()) mi def ii(): return int(sys.stdin.readline()) def ii(): return int(sys.stdin.readline()) ii tmp = min(abs(i - f), abs(j - f)) + abs(i - j) min(abs(i - f), abs(j - f)) + abs(i - j) tmp S_ = [S[0]] + S + [S[A-1]] [S[0]] + S + [S[A-1]] S_ def dp2(ini, i, j): return [[ini]*i for _ in range(j)] def dp2(ini, i, j): return [[ini]*i for _ in range(j)] dp2 Q = mi() mi() Q def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)] li2 to_t = bisect.bisect_left(T, f) bisect.bisect_left(T, f) to_t T_ = [T[0]] + T + [T[B-1]] [T[0]] + T + [T[B-1]] T_ f = ii() ii() f T = [ii() for _ in range(B)] [ii() for _ in range(B)] T
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

A, B, Q = mi()

S = [ii() for _ in range(A)]
T = [ii() for _ in range(B)]

S_ = [S[0]] + S + [S[A-1]]
T_ = [T[0]] + T + [T[B-1]]

for _ in range(Q):
    f = ii()
    to_s = bisect.bisect_left(S, f)
    to_t = bisect.bisect_left(T, f)

    ans = float('inf')

    for i in [S_[to_s], S_[to_s+1]]:
        for j in [T_[to_t], T_[to_t+1]]:
            tmp = min(abs(i - f), abs(j - f)) + abs(i - j)
            ans = min(ans, tmp)
    '''
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t+1]), float('inf'))
    ans = min(abs(S_[to_s+1] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s+1] - f) + abs(S_[to_s+1] - T_[to_t]), ans)
    ans = min(abs(S_[to_s+1] - T_[to_t]) + abs(f - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - T_[to_t+1]) + abs(f - T_[to_t+1]), ans)
    ans = min(abs(S_[to_s] - f) + abs(S_[to_s] - T_[to_t]), ans)
    ans = min(abs(S_[to_s] - T_[to_t]) + abs(f - T_[to_t]), ans)
    '''
    print(ans)