import bisect
a,b,q = map(int,input().split())
s = [-10**11]+[int(input()) for _ in range(a)]+[10**11]
t = [-10**11]+[int(input()) for _ in range(b)]+[10**11]
for i in range(q):
  ans = 10**11
  x = int(input())
  l = bisect.bisect(s,x)
  m = bisect.bisect(t,x)
  arr = [[s[l-1],s[l]],[t[m-1],t[m]]]
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[1-j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  print(ans) 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 = [-10**11]+[int(input()) for _ in range(a)]+[10**11] s [-10**11]+[int(input()) for _ in range(a)]+[10**11] [-10**11]+[int(input()) for _ in range(a)] [-10**11] -10**11 -10 11 [int(input()) for _ in range(a)] [10**11] 10**11 10 11 int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [-10**11]+[int(input()) for _ in range(b)]+[10**11] t [-10**11]+[int(input()) for _ in range(b)]+[10**11] [-10**11]+[int(input()) for _ in range(b)] [-10**11] -10**11 -10 11 [int(input()) for _ in range(b)] [10**11] 10**11 10 11 for i in range(q):
  ans = 10**11
  x = int(input())
  l = bisect.bisect(s,x)
  m = bisect.bisect(t,x)
  arr = [[s[l-1],s[l]],[t[m-1],t[m]]]
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[1-j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  print(ans) i range(q) range q ans = 10**11 ans 10**11 10 11 x = int(input()) x int(input()) int input() input l = bisect.bisect(s,x) l bisect.bisect(s,x) bisect.bisect bisect bisect s x m = bisect.bisect(t,x) m bisect.bisect(t,x) bisect.bisect bisect bisect t x arr = [[s[l-1],s[l]],[t[m-1],t[m]]] arr [[s[l-1],s[l]],[t[m-1],t[m]]] [s[l-1],s[l]] s[l-1] s l-1 l 1 s[l] s l [t[m-1],t[m]] t[m-1] t m-1 m 1 t[m] t m for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
   i range(4) range 4 S = 0 S 0 now = x now x for j in range(2):
      t0 = now-arr[j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
     j range(2) range 2 t0 = now-arr[j][i >> j & 1] t0 now-arr[j][i >> j & 1] now arr[j][i >> j & 1] [j] arr j i >> j & 1 i >> j i j 1 S += t0*((-1)**(t0<0)) S t0*((-1)**(t0<0)) t0 (-1)**(t0<0) -1 t0<0 t0 0 now -= t0 now t0 if ans > S:
      ans = S
   ans > S ans S ans = S ans S for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[1-j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
   i range(4) range 4 S = 0 S 0 now = x now x for j in range(2):
      t0 = now-arr[1-j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
     j range(2) range 2 t0 = now-arr[1-j][i >> j & 1] t0 now-arr[1-j][i >> j & 1] now arr[1-j][i >> j & 1] [1-j] arr 1-j 1 j i >> j & 1 i >> j i j 1 S += t0*((-1)**(t0<0)) S t0*((-1)**(t0<0)) t0 (-1)**(t0<0) -1 t0<0 t0 0 now -= t0 now t0 if ans > S:
      ans = S
   ans > S ans S ans = S ans S print(ans) print ans S = 0 0 S now = x x now q = map(int,input().split()) map(int,input().split()) q l = bisect.bisect(s,x) bisect.bisect(s,x) l S += t0*((-1)**(t0<0)) t0*((-1)**(t0<0)) S ans = 10**11 10**11 ans b,q = map(int,input().split()) map(int,input().split()) b s = [-10**11]+[int(input()) for _ in range(a)]+[10**11] [-10**11]+[int(input()) for _ in range(a)]+[10**11] s m = bisect.bisect(t,x) bisect.bisect(t,x) m a,b,q = map(int,input().split()) map(int,input().split()) a t0 = now-arr[1-j][i >> j & 1] now-arr[1-j][i >> j & 1] t0 now -= t0 t0 now ans = S S ans arr = [[s[l-1],s[l]],[t[m-1],t[m]]] [[s[l-1],s[l]],[t[m-1],t[m]]] arr now = x x now t0 = now-arr[j][i >> j & 1] now-arr[j][i >> j & 1] t0 ans = S S ans x = int(input()) int(input()) x S += t0*((-1)**(t0<0)) t0*((-1)**(t0<0)) S S = 0 0 S now -= t0 t0 now t = [-10**11]+[int(input()) for _ in range(b)]+[10**11] [-10**11]+[int(input()) for _ in range(b)]+[10**11] t
import bisect
a,b,q = map(int,input().split())
s = [-10**11]+[int(input()) for _ in range(a)]+[10**11]
t = [-10**11]+[int(input()) for _ in range(b)]+[10**11]
for i in range(q):
  ans = 10**11
  x = int(input())
  l = bisect.bisect(s,x)
  m = bisect.bisect(t,x)
  arr = [[s[l-1],s[l]],[t[m-1],t[m]]]
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  for i in range(4):
    S = 0
    now = x
    for j in range(2):
      t0 = now-arr[1-j][i >> j & 1]
      S += t0*((-1)**(t0<0))
      now -= t0
    if ans > S:
      ans = S
  print(ans)