# coding: utf-8
import sys
from bisect import bisect_left

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 番兵を左右に置いて、4通り試す
A, B, Q = lr()
INF = 10 ** 12
S = [-INF] + [ir() for _ in range(A)] + [INF]
T = [-INF] + [ir() for _ in range(B)] + [INF]
S.sort(); T.sort()
for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    temp = []
    temp.append(max(S[si], T[ti]) - x)
    y = abs(S[si] - x)
    z = abs(T[ti-1] - x)
    temp.append(min(y, z) * 2 + max(y, z))
    y = abs(S[si-1] - x)
    z = abs(T[ti] - x)
    temp.append(min(y, z) * 2 + max(y, z))
    temp.append(x - min(S[si-1], T[ti-1]))
    print(min(temp))

# 46 import sys sys from bisect import bisect_left sr = lambda: sys.stdin.readline().rstrip() sr lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ir = lambda: int(sr()) ir lambda: int(sr()) int(sr()) int sr() sr lr = lambda: list(map(int, sr().split())) lr lambda: list(map(int, sr().split())) list(map(int, sr().split())) list map(int, sr().split()) map int sr().split() ().split () sr split A, B, Q = lr() A lr() lr B Q INF = 10 ** 12 INF 10 ** 12 10 12 ir() for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) ir() ir S = [-INF] + [ir() for _ in range(A)] + [INF] S [-INF] + [ir() for _ in range(A)] + [INF] [-INF] + [ir() for _ in range(A)] [-INF] -INF INF [ir() for _ in range(A)] [INF] INF ir() for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) ir() ir T = [-INF] + [ir() for _ in range(B)] + [INF] T [-INF] + [ir() for _ in range(B)] + [INF] [-INF] + [ir() for _ in range(B)] [-INF] -INF INF [ir() for _ in range(B)] [INF] INF S.sort() S.sort S sort T.sort() T.sort T sort for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    temp = []
    temp.append(max(S[si], T[ti]) - x)
    y = abs(S[si] - x)
    z = abs(T[ti-1] - x)
    temp.append(min(y, z) * 2 + max(y, z))
    y = abs(S[si-1] - x)
    z = abs(T[ti] - x)
    temp.append(min(y, z) * 2 + max(y, z))
    temp.append(x - min(S[si-1], T[ti-1]))
    print(min(temp))

# 46 _ range(Q) range Q x = ir() x ir() ir si = bisect_left(S, x) si bisect_left(S, x) bisect_left S x ti = bisect_left(T, x) ti bisect_left(T, x) bisect_left T x temp = [] temp [] temp.append(max(S[si], T[ti]) - x) temp.append temp append max(S[si], T[ti]) - x max(S[si], T[ti]) max S[si] S si T[ti] T ti x y = abs(S[si] - x) y abs(S[si] - x) abs S[si] - x S[si] S si x z = abs(T[ti-1] - x) z abs(T[ti-1] - x) abs T[ti-1] - x T[ti-1] T ti-1 ti 1 x temp.append(min(y, z) * 2 + max(y, z)) temp.append temp append min(y, z) * 2 + max(y, z) min(y, z) * 2 min(y, z) min y z 2 max(y, z) max y z y = abs(S[si-1] - x) y abs(S[si-1] - x) abs S[si-1] - x S[si-1] S si-1 si 1 x z = abs(T[ti] - x) z abs(T[ti] - x) abs T[ti] - x T[ti] T ti x temp.append(min(y, z) * 2 + max(y, z)) temp.append temp append min(y, z) * 2 + max(y, z) min(y, z) * 2 min(y, z) min y z 2 max(y, z) max y z temp.append(x - min(S[si-1], T[ti-1])) temp.append temp append x - min(S[si-1], T[ti-1]) x min(S[si-1], T[ti-1]) min S[si-1] S si-1 si 1 T[ti-1] T ti-1 ti 1 print(min(temp)) print min(temp) min temp ir = lambda: int(sr()) lambda: int(sr()) ir si = bisect_left(S, x) bisect_left(S, x) si T = [-INF] + [ir() for _ in range(B)] + [INF] [-INF] + [ir() for _ in range(B)] + [INF] T B, Q = lr() lr() B y = abs(S[si] - x) abs(S[si] - x) y z = abs(T[ti-1] - x) abs(T[ti-1] - x) z z = abs(T[ti] - x) abs(T[ti] - x) z ti = bisect_left(T, x) bisect_left(T, x) ti y = abs(S[si-1] - x) abs(S[si-1] - x) y sr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() sr temp = [] [] temp lr = lambda: list(map(int, sr().split())) lambda: list(map(int, sr().split())) lr x = ir() ir() x Q = lr() lr() Q A, B, Q = lr() lr() A S = [-INF] + [ir() for _ in range(A)] + [INF] [-INF] + [ir() for _ in range(A)] + [INF] S INF = 10 ** 12 10 ** 12 INF
# coding: utf-8
import sys
from bisect import bisect_left

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 番兵を左右に置いて、4通り試す
A, B, Q = lr()
INF = 10 ** 12
S = [-INF] + [ir() for _ in range(A)] + [INF]
T = [-INF] + [ir() for _ in range(B)] + [INF]
S.sort(); T.sort()
for _ in range(Q):
    x = ir()
    si = bisect_left(S, x)
    ti = bisect_left(T, x)
    temp = []
    temp.append(max(S[si], T[ti]) - x)
    y = abs(S[si] - x)
    z = abs(T[ti-1] - x)
    temp.append(min(y, z) * 2 + max(y, z))
    y = abs(S[si-1] - x)
    z = abs(T[ti] - x)
    temp.append(min(y, z) * 2 + max(y, z))
    temp.append(x - min(S[si-1], T[ti-1]))
    print(min(temp))

# 46
