import sys
input = sys.stdin.readline
import bisect

a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]

for _ in range(q):
  x = int(input())
  s_bi = bisect.bisect_right(S, x)
  t_bi = bisect.bisect_right(T, x)
  s_left = S[s_bi-1] if s_bi>0 else -float("inf")
  s_right = S[s_bi] if s_bi<a else float("inf")
  t_left = T[t_bi-1] if t_bi>0 else -float("inf")
  t_right = T[t_bi] if t_bi<b else float("inf")
  c = x - min(s_left, t_left)
  d = max(s_right, t_right) - x
  e = t_right - s_left + min(x-s_left, t_right-x)
  f = s_right - t_left + min(x-t_left, s_right-x)
  ans = min(c, d, e, f)
  print(ans) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import bisect bisect a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input S = [int(input()) for _ in range(a)] S [int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input T = [int(input()) for _ in range(b)] T [int(input()) for _ in range(b)] for _ in range(q):
  x = int(input())
  s_bi = bisect.bisect_right(S, x)
  t_bi = bisect.bisect_right(T, x)
  s_left = S[s_bi-1] if s_bi>0 else -float("inf")
  s_right = S[s_bi] if s_bi<a else float("inf")
  t_left = T[t_bi-1] if t_bi>0 else -float("inf")
  t_right = T[t_bi] if t_bi<b else float("inf")
  c = x - min(s_left, t_left)
  d = max(s_right, t_right) - x
  e = t_right - s_left + min(x-s_left, t_right-x)
  f = s_right - t_left + min(x-t_left, s_right-x)
  ans = min(c, d, e, f)
  print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input s_bi = bisect.bisect_right(S, x) s_bi bisect.bisect_right(S, x) bisect.bisect_right bisect bisect_right S x t_bi = bisect.bisect_right(T, x) t_bi bisect.bisect_right(T, x) bisect.bisect_right bisect bisect_right T x s_left = S[s_bi-1] if s_bi>0 else -float("inf") s_left S[s_bi-1] if s_bi>0 else -float("inf") s_bi>0 s_bi 0 S[s_bi-1] S s_bi-1 s_bi 1 -float("inf") float("inf") float "inf" s_right = S[s_bi] if s_bi<a else float("inf") s_right S[s_bi] if s_bi<a else float("inf") s_bi<a s_bi a S[s_bi] S s_bi float("inf") float "inf" t_left = T[t_bi-1] if t_bi>0 else -float("inf") t_left T[t_bi-1] if t_bi>0 else -float("inf") t_bi>0 t_bi 0 T[t_bi-1] T t_bi-1 t_bi 1 -float("inf") float("inf") float "inf" t_right = T[t_bi] if t_bi<b else float("inf") t_right T[t_bi] if t_bi<b else float("inf") t_bi<b t_bi b T[t_bi] T t_bi float("inf") float "inf" c = x - min(s_left, t_left) c x - min(s_left, t_left) x min(s_left, t_left) min s_left t_left d = max(s_right, t_right) - x d max(s_right, t_right) - x max(s_right, t_right) max s_right t_right x e = t_right - s_left + min(x-s_left, t_right-x) e t_right - s_left + min(x-s_left, t_right-x) t_right - s_left t_right s_left min(x-s_left, t_right-x) min x-s_left x s_left t_right-x t_right x f = s_right - t_left + min(x-t_left, s_right-x) f s_right - t_left + min(x-t_left, s_right-x) s_right - t_left s_right t_left min(x-t_left, s_right-x) min x-t_left x t_left s_right-x s_right x ans = min(c, d, e, f) ans min(c, d, e, f) min c d e f print(ans) print ans t_bi = bisect.bisect_right(T, x) bisect.bisect_right(T, x) t_bi q = map(int, input().split()) map(int, input().split()) q s_bi = bisect.bisect_right(S, x) bisect.bisect_right(S, x) s_bi b, q = map(int, input().split()) map(int, input().split()) b S = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] S x = int(input()) int(input()) x t_left = T[t_bi-1] if t_bi>0 else -float("inf") T[t_bi-1] if t_bi>0 else -float("inf") t_left T = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] T e = t_right - s_left + min(x-s_left, t_right-x) t_right - s_left + min(x-s_left, t_right-x) e a, b, q = map(int, input().split()) map(int, input().split()) a s_right = S[s_bi] if s_bi<a else float("inf") S[s_bi] if s_bi<a else float("inf") s_right ans = min(c, d, e, f) min(c, d, e, f) ans d = max(s_right, t_right) - x max(s_right, t_right) - x d s_left = S[s_bi-1] if s_bi>0 else -float("inf") S[s_bi-1] if s_bi>0 else -float("inf") s_left f = s_right - t_left + min(x-t_left, s_right-x) s_right - t_left + min(x-t_left, s_right-x) f input = sys.stdin.readline sys.stdin.readline input c = x - min(s_left, t_left) x - min(s_left, t_left) c t_right = T[t_bi] if t_bi<b else float("inf") T[t_bi] if t_bi<b else float("inf") t_right
import sys
input = sys.stdin.readline
import bisect

a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]

for _ in range(q):
  x = int(input())
  s_bi = bisect.bisect_right(S, x)
  t_bi = bisect.bisect_right(T, x)
  s_left = S[s_bi-1] if s_bi>0 else -float("inf")
  s_right = S[s_bi] if s_bi<a else float("inf")
  t_left = T[t_bi-1] if t_bi>0 else -float("inf")
  t_right = T[t_bi] if t_bi<b else float("inf")
  c = x - min(s_left, t_left)
  d = max(s_right, t_right) - x
  e = t_right - s_left + min(x-s_left, t_right-x)
  f = s_right - t_left + min(x-t_left, s_right-x)
  ans = min(c, d, e, f)
  print(ans)