import bisect

import itertools



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



# 簡略化のため常に左右に存在するようにしておく

INF = 10 ** 15

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 solve(x):

  # xの位置

  i = bisect.bisect_left(S, x)

  j = bisect.bisect_left(T, x)

  result = INF

  # どの2つを目指すのか

  for s,t in itertools.product(S[i-1:i+1], T[j-1:j+1]):

    d = min(abs(s-x),abs(t-x)) + abs(t-s)

    result = min(result,d)

  return result



for x in X:

  answer = solve(x)

  print(answer)

# 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 bisect
import itertools

A, B, Q = list(map(int, input().split()))
# 簡略化のため常に左右に存在するようにしておく
INF = 10**15
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 solve(x):
    # xの位置
    i = bisect.bisect_left(S, x)
    j = bisect.bisect_left(T, x)
    result = INF
    # どの2つを目指すのか
    for s, t in itertools.product(S[i - 1 : i + 1], T[j - 1 : j + 1]):
        d = min(abs(s - x), abs(t - x)) + abs(t - s)
        result = min(result, d)
    return result


for x in X:
    answer = solve(x)
    print(answer)

# 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 bisect -import itertools +# coding: utf-8 +import sys +from bisect import bisect_left -A, B, Q = list(map(int, input().split())) -# 簡略化のため常に左右に存在するようにしておく -INF = 10**15 -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 solve(x): -    # xの位置 -    i = bisect.bisect_left(S, x) -    j = bisect.bisect_left(T, x) -    result = INF -    # どの2つを目指すのか -    for s, t in itertools.product(S[i - 1 : i + 1], T[j - 1 : j + 1]): -        d = min(abs(s - x), abs(t - x)) + abs(t - s) -        result = min(result, d) -    return result - - -for x in X: -    answer = solve(x) -    print(answer) +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