import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
  x = int(input())
  b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
  #print(b,d)
  res = INF
  for S in [s[b - 1], s[b]]:
    for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
  print(res) import bisect bisect A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q INF = 10 ** 18 INF 10 ** 18 10 18 int(input()) for i in range(A) for i in range(A) i range(A) range A for i in range(A) int(input()) int input() input s = [-INF] + [int(input()) for i in range(A)] + [INF] s [-INF] + [int(input()) for i in range(A)] + [INF] [-INF] + [int(input()) for i in range(A)] [-INF] -INF INF [int(input()) for i in range(A)] [INF] INF int(input()) for i in range(B) for i in range(B) i range(B) range B for i in range(B) int(input()) int input() input t = [-INF] + [int(input()) for i in range(B)] + [INF] t [-INF] + [int(input()) for i in range(B)] + [INF] [-INF] + [int(input()) for i in range(B)] [-INF] -INF INF [int(input()) for i in range(B)] [INF] INF for q in range(Q):
  x = int(input())
  b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
  #print(b,d)
  res = INF
  for S in [s[b - 1], s[b]]:
    for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
  print(res) q range(Q) range Q x = int(input()) x int(input()) int input() input b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x) b bisect.bisect_left(s, x) bisect.bisect_left bisect bisect_left s x d bisect.bisect_left(t, x) bisect.bisect_left bisect bisect_left t x res = INF res INF for S in [s[b - 1], s[b]]:
    for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
   S [s[b - 1], s[b]] s[b - 1] s b - 1 b 1 s[b] s b for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
   T [t[d - 1], t[d]] t[d - 1] t d - 1 d 1 t[d] t d d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T) d1 abs(S - x) + abs(T - S) abs(S - x) abs S - x S x abs(T - S) abs T - S T S d2 abs(T - x) + abs(S - T) abs(T - x) abs T - x T x abs(S - T) abs S - T S T res = min(res, d1, d2) res min(res, d1, d2) min res d1 d2 print(res) print res x = int(input()) int(input()) x B, Q = map(int, input().split()) map(int, input().split()) B A, B, Q = map(int, input().split()) map(int, input().split()) A Q = map(int, input().split()) map(int, input().split()) Q d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T) abs(T - x) + abs(S - T) d2 res = INF INF res b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x) bisect.bisect_left(s, x) b INF = 10 ** 18 10 ** 18 INF s = [-INF] + [int(input()) for i in range(A)] + [INF] [-INF] + [int(input()) for i in range(A)] + [INF] s d = bisect.bisect_left(s, x), bisect.bisect_left(t, x) bisect.bisect_left(t, x) d res = min(res, d1, d2) min(res, d1, d2) res d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T) abs(S - x) + abs(T - S) d1 t = [-INF] + [int(input()) for i in range(B)] + [INF] [-INF] + [int(input()) for i in range(B)] + [INF] t
import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
  x = int(input())
  b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
  #print(b,d)
  res = INF
  for S in [s[b - 1], s[b]]:
    for T in [t[d - 1], t[d]]:
      d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
      res = min(res, d1, d2)
  print(res)