from bisect import bisect_right


a, b, q = map(int, input().split())
INF = 10 ** 18
J = [-INF] + [int(input()) for _ in range(a)] + [INF]
T = [-INF] + [int(input()) for _ in range(b)] + [INF]

for _ in range(q):
  s = int(input())
  b, d = bisect_right(J, s), bisect_right(T, s)
  res = INF
  for j in [J[b - 1], J[b]]:
    for t in [T[d - 1], T[d]]:
      d1, d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - t)
      res = min(res, d1, d2)
  print(res) 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 = 10 ** 18 INF 10 ** 18 10 18 int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input J = [-INF] + [int(input()) for _ in range(a)] + [INF] J [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] [-INF] -INF INF [int(input()) for _ in range(a)] [INF] INF int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input T = [-INF] + [int(input()) for _ in range(b)] + [INF] T [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] [-INF] -INF INF [int(input()) for _ in range(b)] [INF] INF for _ in range(q):
  s = int(input())
  b, d = bisect_right(J, s), bisect_right(T, s)
  res = INF
  for j in [J[b - 1], J[b]]:
    for t in [T[d - 1], T[d]]:
      d1, d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - t)
      res = min(res, d1, d2)
  print(res) _ range(q) range q s = int(input()) s int(input()) int input() input b, d = bisect_right(J, s), bisect_right(T, s) b bisect_right(J, s) bisect_right J s d bisect_right(T, s) bisect_right T s res = INF res INF for j in [J[b - 1], J[b]]:
    for t in [T[d - 1], T[d]]:
      d1, d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - t)
      res = min(res, d1, d2)
   j [J[b - 1], J[b]] J[b - 1] J b - 1 b 1 J[b] J b for t in [T[d - 1], T[d]]:
      d1, d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - 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(j - s) + abs(t - j), abs(t - s) + abs(j - t) d1 abs(j - s) + abs(t - j) abs(j - s) abs j - s j s abs(t - j) abs t - j t j d2 abs(t - s) + abs(j - t) abs(t - s) abs t - s t s abs(j - t) abs j - t j t res = min(res, d1, d2) res min(res, d1, d2) min res d1 d2 print(res) print res INF = 10 ** 18 10 ** 18 INF res = min(res, d1, d2) min(res, d1, d2) res q = map(int, input().split()) map(int, input().split()) q s = int(input()) int(input()) s b, d = bisect_right(J, s), bisect_right(T, s) bisect_right(J, s) b res = INF INF res d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - t) abs(t - s) + abs(j - t) d2 J = [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] + [INF] J d1, d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - t) abs(j - s) + abs(t - j) d1 b, q = map(int, input().split()) map(int, input().split()) b a, b, q = map(int, input().split()) map(int, input().split()) a T = [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] + [INF] T d = bisect_right(J, s), bisect_right(T, s) bisect_right(T, s) d
from bisect import bisect_right


a, b, q = map(int, input().split())
INF = 10 ** 18
J = [-INF] + [int(input()) for _ in range(a)] + [INF]
T = [-INF] + [int(input()) for _ in range(b)] + [INF]

for _ in range(q):
  s = int(input())
  b, d = bisect_right(J, s), bisect_right(T, s)
  res = INF
  for j in [J[b - 1], J[b]]:
    for t in [T[d - 1], T[d]]:
      d1, d2 = abs(j - s) + abs(t - j), abs(t - s) + abs(j - t)
      res = min(res, d1, d2)
  print(res)