import sys
 
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
inf = float("INF")
a,b,q = map(int, input().split())
s = [None] * (a + 3)
s[0:2] = [-inf,-inf]
s[-1] = inf
t = [None] * (b + 3)
t[0:2] = [-inf,-inf]
t[-1] = inf
for i in range(a):
	s[i+2] = int(input())
for i in range(b):
	t[i+2] = int(input())

from bisect import bisect_left

dp0 = [None] * (a+3)
dp1 = [None] * (b+3)

def f(s,t,x,ss,i):
  if i == 0 and dp0[ss] != None: return abs(x - s[ss]) + dp0[ss]
  elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
  tr = bisect_left(t, s[ss])
  tl = tr - 1
  if i == 0: dp0[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  if i == 1: dp1[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  return abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))


for _ in range(q):
  ans = inf
  x = int(input())
  sr = bisect_left(s, x)
  ans = min(ans, f(s,t,x,sr,0))
  ans = min(ans, f(s,t,x,sr - 1,0))
  tr = bisect_left(t, x)
  ans = min(ans, f(t,s,x,tr,1))
  ans = min(ans, f(t,s,x,tr - 1,1))
  print(ans)
   import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline inputs = sys.stdin.buffer.readlines inputs sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines inf = float("INF") inf float("INF") float "INF" a,b,q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q s = [None] * (a + 3) s [None] * (a + 3) [None] None a + 3 a 3 s[0:2] = [-inf,-inf] s[0:2] s 0:2 0 2 [-inf,-inf] -inf inf -inf inf s[-1] = inf s[-1] s -1 inf t = [None] * (b + 3) t [None] * (b + 3) [None] None b + 3 b 3 t[0:2] = [-inf,-inf] t[0:2] t 0:2 0 2 [-inf,-inf] -inf inf -inf inf t[-1] = inf t[-1] t -1 inf for i in range(a):
	s[i+2] = int(input()) i range(a) range a s[i+2] = int(input()) s[i+2] s i+2 i 2 int(input()) int input() input for i in range(b):
	t[i+2] = int(input()) i range(b) range b t[i+2] = int(input()) t[i+2] t i+2 i 2 int(input()) int input() input from bisect import bisect_left dp0 = [None] * (a+3) dp0 [None] * (a+3) [None] None a+3 a 3 dp1 = [None] * (b+3) dp1 [None] * (b+3) [None] None b+3 b 3 def f(s,t,x,ss,i):
  if i == 0 and dp0[ss] != None: return abs(x - s[ss]) + dp0[ss]
  elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
  tr = bisect_left(t, s[ss])
  tl = tr - 1
  if i == 0: dp0[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  if i == 1: dp1[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  return abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr])) f if i == 0 and dp0[ss] != None: return abs(x - s[ss]) + dp0[ss]
  elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
   i == 0 and dp0[ss] != None i == 0 i 0 dp0[ss] != None dp0[ss] dp0 ss None elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
   i == 1 and dp1[ss] != None i == 1 i 1 dp1[ss] != None dp1[ss] dp1 ss None tr = bisect_left(t, s[ss]) tr bisect_left(t, s[ss]) bisect_left t s[ss] s ss tl = tr - 1 tl tr - 1 tr 1 if i == 0: dp0[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
   i == 0 i 0 if i == 1: dp1[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
   i == 1 i 1 return abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr])) abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr])) abs(x - s[ss]) abs x - s[ss] x s[ss] s ss min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr])) min abs(s[ss] - t[tl]) abs s[ss] - t[tl] s[ss] s ss t[tl] t tl abs(s[ss] - t[tr]) abs s[ss] - t[tr] s[ss] s ss t[tr] t tr s s t t x x ss ss i i for _ in range(q):
  ans = inf
  x = int(input())
  sr = bisect_left(s, x)
  ans = min(ans, f(s,t,x,sr,0))
  ans = min(ans, f(s,t,x,sr - 1,0))
  tr = bisect_left(t, x)
  ans = min(ans, f(t,s,x,tr,1))
  ans = min(ans, f(t,s,x,tr - 1,1))
  print(ans)
   _ range(q) range q ans = inf ans inf x = int(input()) x int(input()) int input() input sr = bisect_left(s, x) sr bisect_left(s, x) bisect_left s x ans = min(ans, f(s,t,x,sr,0)) ans min(ans, f(s,t,x,sr,0)) min ans f(s,t,x,sr,0) f s t x sr 0 ans = min(ans, f(s,t,x,sr - 1,0)) ans min(ans, f(s,t,x,sr - 1,0)) min ans f(s,t,x,sr - 1,0) f s t x sr - 1 sr 1 0 tr = bisect_left(t, x) tr bisect_left(t, x) bisect_left t x ans = min(ans, f(t,s,x,tr,1)) ans min(ans, f(t,s,x,tr,1)) min ans f(t,s,x,tr,1) f t s x tr 1 ans = min(ans, f(t,s,x,tr - 1,1)) ans min(ans, f(t,s,x,tr - 1,1)) min ans f(t,s,x,tr - 1,1) f t s x tr - 1 tr 1 1 print(ans) print ans a,b,q = map(int, input().split()) map(int, input().split()) a q = map(int, input().split()) map(int, input().split()) q ans = min(ans, f(t,s,x,tr - 1,1)) min(ans, f(t,s,x,tr - 1,1)) ans dp1 = [None] * (b+3) [None] * (b+3) dp1 read = sys.stdin.buffer.read sys.stdin.buffer.read read b,q = map(int, input().split()) map(int, input().split()) b tr = bisect_left(t, x) bisect_left(t, x) tr ans = inf inf ans t = [None] * (b + 3) [None] * (b + 3) t inputs = sys.stdin.buffer.readlines sys.stdin.buffer.readlines inputs s = [None] * (a + 3) [None] * (a + 3) s x = int(input()) int(input()) x input = sys.stdin.buffer.readline sys.stdin.buffer.readline input ans = min(ans, f(s,t,x,sr - 1,0)) min(ans, f(s,t,x,sr - 1,0)) ans inf = float("INF") float("INF") inf ans = min(ans, f(t,s,x,tr,1)) min(ans, f(t,s,x,tr,1)) ans ans = min(ans, f(s,t,x,sr,0)) min(ans, f(s,t,x,sr,0)) ans sr = bisect_left(s, x) bisect_left(s, x) sr dp0 = [None] * (a+3) [None] * (a+3) dp0 def f(s,t,x,ss,i):
  if i == 0 and dp0[ss] != None: return abs(x - s[ss]) + dp0[ss]
  elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
  tr = bisect_left(t, s[ss])
  tl = tr - 1
  if i == 0: dp0[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  if i == 1: dp1[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  return abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr])) def f(s,t,x,ss,i):
  if i == 0 and dp0[ss] != None: return abs(x - s[ss]) + dp0[ss]
  elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
  tr = bisect_left(t, s[ss])
  tl = tr - 1
  if i == 0: dp0[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  if i == 1: dp1[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  return abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr])) f
import sys
 
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
inf = float("INF")
a,b,q = map(int, input().split())
s = [None] * (a + 3)
s[0:2] = [-inf,-inf]
s[-1] = inf
t = [None] * (b + 3)
t[0:2] = [-inf,-inf]
t[-1] = inf
for i in range(a):
	s[i+2] = int(input())
for i in range(b):
	t[i+2] = int(input())

from bisect import bisect_left

dp0 = [None] * (a+3)
dp1 = [None] * (b+3)

def f(s,t,x,ss,i):
  if i == 0 and dp0[ss] != None: return abs(x - s[ss]) + dp0[ss]
  elif i == 1 and dp1[ss] != None: return abs(x - s[ss]) + dp1[ss]
  tr = bisect_left(t, s[ss])
  tl = tr - 1
  if i == 0: dp0[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  if i == 1: dp1[ss] = min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))
  return abs(x - s[ss]) + min(abs(s[ss] - t[tl]), abs(s[ss] - t[tr]))


for _ in range(q):
  ans = inf
  x = int(input())
  sr = bisect_left(s, x)
  ans = min(ans, f(s,t,x,sr,0))
  ans = min(ans, f(s,t,x,sr - 1,0))
  tr = bisect_left(t, x)
  ans = min(ans, f(t,s,x,tr,1))
  ans = min(ans, f(t,s,x,tr - 1,1))
  print(ans)
  
