ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

mx = 3*10**10
a,b,q = ma()
S = [0 for i in range(a+2)]
T = [0 for i in range(b+2)]
S[0] = -mx;S[a+1] = mx
T[0] = -mx;T[b+1] = mx
for i in range(a):
    S[i+1]=ni()
for i in range(b):
    T[i+1]=ni()

def bs(x,ls):##ls == S or T
    ok =0
    ng = len(ls)-1
    while ng-ok > 1:
        idx = (ok+ng)//2
        if ls[idx] < x:
            ok = idx
        else:
            ng = idx
    return ok  #xよりも左にあるidxを返す
def solve(x):
    ids = bs(x,S)
    s1 = S[ids] #自分より左
    s2 = S[ids+1] #自分と同じか右
    idt = bs(x,T)
    t1 = T[idt]
    t2 = T[idt+1]

    s1t1 = max(x-s1,x-t1)
    s1t2 = 2*min(x-s1,t2-x) + max(x-s1,t2-x)
    s2t1 = 2*min(s2-x,x-t1) + max(s2-x,x-t1)
    s2t2 = max(s2-x,t2-x)
    print(min(s1t1,s1t2,s2t1,s2t2))

for i in range(q):
    x = ni()
    solve(x) ma = lambda :map(int,input().split()) ma lambda :map(int,input().split()) map(int,input().split()) map int input().split() ().split () input split lma = lambda :list(map(int,input().split())) lma lambda :list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split tma = lambda :tuple(map(int,input().split())) tma lambda :tuple(map(int,input().split())) tuple(map(int,input().split())) tuple map(int,input().split()) map int input().split() ().split () input split ni = lambda:int(input()) ni lambda:int(input()) int(input()) int input() input yn = lambda fl:print("Yes") if fl else print("No") yn lambda fl:print("Yes") if fl else print("No") print("Yes") if fl else print("No") fl print("Yes") print "Yes" print("No") print "No" fl import collections collections import math math import itertools itertools import heapq as hq heapq mx = 3*10**10 mx 3*10**10 3 10**10 10 10 a,b,q = ma() a ma() ma b q 0 for i in range(a+2) for i in range(a+2) i range(a+2) range a+2 a 2 for i in range(a+2) 0 S = [0 for i in range(a+2)] S [0 for i in range(a+2)] 0 for i in range(b+2) for i in range(b+2) i range(b+2) range b+2 b 2 for i in range(b+2) 0 T = [0 for i in range(b+2)] T [0 for i in range(b+2)] S[0] = -mx S[0] S 0 -mx mx S[a+1] = mx S[a+1] S a+1 a 1 mx T[0] = -mx T[0] T 0 -mx mx T[b+1] = mx T[b+1] T b+1 b 1 mx for i in range(a):
    S[i+1]=ni() i range(a) range a S[i+1]=ni() S[i+1] S i+1 i 1 ni() ni for i in range(b):
    T[i+1]=ni() i range(b) range b T[i+1]=ni() T[i+1] T i+1 i 1 ni() ni def bs(x,ls):##ls == S or T
    ok =0
    ng = len(ls)-1
    while ng-ok > 1:
        idx = (ok+ng)//2
        if ls[idx] < x:
            ok = idx
        else:
            ng = idx
    return ok  #xよりも左にあるidxを返す bs ok =0 ok 0 ng = len(ls)-1 ng len(ls)-1 len(ls) len ls 1 while ng-ok > 1:
        idx = (ok+ng)//2
        if ls[idx] < x:
            ok = idx
        else:
            ng = idx
     ng-ok > 1 ng-ok ng ok 1 idx = (ok+ng)//2 idx (ok+ng)//2 ok+ng ok ng 2 if ls[idx] < x:
            ok = idx
        else:
            ng = idx
     ls[idx] < x ls[idx] ls idx x ok = idx ok idx ng = idx ng idx return ok ok x x ls ls def solve(x):
    ids = bs(x,S)
    s1 = S[ids] #自分より左
    s2 = S[ids+1] #自分と同じか右
    idt = bs(x,T)
    t1 = T[idt]
    t2 = T[idt+1]

    s1t1 = max(x-s1,x-t1)
    s1t2 = 2*min(x-s1,t2-x) + max(x-s1,t2-x)
    s2t1 = 2*min(s2-x,x-t1) + max(s2-x,x-t1)
    s2t2 = max(s2-x,t2-x)
    print(min(s1t1,s1t2,s2t1,s2t2)) solve ids = bs(x,S) ids bs(x,S) bs x S s1 = S[ids] s1 S[ids] S ids s2 = S[ids+1] s2 S[ids+1] S ids+1 ids 1 idt = bs(x,T) idt bs(x,T) bs x T t1 = T[idt] t1 T[idt] T idt t2 = T[idt+1] t2 T[idt+1] T idt+1 idt 1 s1t1 = max(x-s1,x-t1) s1t1 max(x-s1,x-t1) max x-s1 x s1 x-t1 x t1 s1t2 = 2*min(x-s1,t2-x) + max(x-s1,t2-x) s1t2 2*min(x-s1,t2-x) + max(x-s1,t2-x) 2*min(x-s1,t2-x) 2 min(x-s1,t2-x) min x-s1 x s1 t2-x t2 x max(x-s1,t2-x) max x-s1 x s1 t2-x t2 x s2t1 = 2*min(s2-x,x-t1) + max(s2-x,x-t1) s2t1 2*min(s2-x,x-t1) + max(s2-x,x-t1) 2*min(s2-x,x-t1) 2 min(s2-x,x-t1) min s2-x s2 x x-t1 x t1 max(s2-x,x-t1) max s2-x s2 x x-t1 x t1 s2t2 = max(s2-x,t2-x) s2t2 max(s2-x,t2-x) max s2-x s2 x t2-x t2 x print(min(s1t1,s1t2,s2t1,s2t2)) print min(s1t1,s1t2,s2t1,s2t2) min s1t1 s1t2 s2t1 s2t2 x x for i in range(q):
    x = ni()
    solve(x) i range(q) range q x = ni() x ni() ni solve(x) solve x S = [0 for i in range(a+2)] [0 for i in range(a+2)] S ma = lambda :map(int,input().split()) lambda :map(int,input().split()) ma T = [0 for i in range(b+2)] [0 for i in range(b+2)] T a,b,q = ma() ma() a mx = 3*10**10 3*10**10 mx def solve(x):
    ids = bs(x,S)
    s1 = S[ids] #自分より左
    s2 = S[ids+1] #自分と同じか右
    idt = bs(x,T)
    t1 = T[idt]
    t2 = T[idt+1]

    s1t1 = max(x-s1,x-t1)
    s1t2 = 2*min(x-s1,t2-x) + max(x-s1,t2-x)
    s2t1 = 2*min(s2-x,x-t1) + max(s2-x,x-t1)
    s2t2 = max(s2-x,t2-x)
    print(min(s1t1,s1t2,s2t1,s2t2)) def solve(x):
    ids = bs(x,S)
    s1 = S[ids] #自分より左
    s2 = S[ids+1] #自分と同じか右
    idt = bs(x,T)
    t1 = T[idt]
    t2 = T[idt+1]

    s1t1 = max(x-s1,x-t1)
    s1t2 = 2*min(x-s1,t2-x) + max(x-s1,t2-x)
    s2t1 = 2*min(s2-x,x-t1) + max(s2-x,x-t1)
    s2t2 = max(s2-x,t2-x)
    print(min(s1t1,s1t2,s2t1,s2t2)) solve lma = lambda :list(map(int,input().split())) lambda :list(map(int,input().split())) lma ni = lambda:int(input()) lambda:int(input()) ni yn = lambda fl:print("Yes") if fl else print("No") lambda fl:print("Yes") if fl else print("No") yn b,q = ma() ma() b def bs(x,ls):##ls == S or T
    ok =0
    ng = len(ls)-1
    while ng-ok > 1:
        idx = (ok+ng)//2
        if ls[idx] < x:
            ok = idx
        else:
            ng = idx
    return ok  #xよりも左にあるidxを返す def bs(x,ls):##ls == S or T
    ok =0
    ng = len(ls)-1
    while ng-ok > 1:
        idx = (ok+ng)//2
        if ls[idx] < x:
            ok = idx
        else:
            ng = idx
    return ok  #xよりも左にあるidxを返す bs x = ni() ni() x q = ma() ma() q tma = lambda :tuple(map(int,input().split())) lambda :tuple(map(int,input().split())) tma
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq

mx = 3*10**10
a,b,q = ma()
S = [0 for i in range(a+2)]
T = [0 for i in range(b+2)]
S[0] = -mx;S[a+1] = mx
T[0] = -mx;T[b+1] = mx
for i in range(a):
    S[i+1]=ni()
for i in range(b):
    T[i+1]=ni()

def bs(x,ls):##ls == S or T
    ok =0
    ng = len(ls)-1
    while ng-ok > 1:
        idx = (ok+ng)//2
        if ls[idx] < x:
            ok = idx
        else:
            ng = idx
    return ok  #xよりも左にあるidxを返す
def solve(x):
    ids = bs(x,S)
    s1 = S[ids] #自分より左
    s2 = S[ids+1] #自分と同じか右
    idt = bs(x,T)
    t1 = T[idt]
    t2 = T[idt+1]

    s1t1 = max(x-s1,x-t1)
    s1t2 = 2*min(x-s1,t2-x) + max(x-s1,t2-x)
    s2t1 = 2*min(s2-x,x-t1) + max(s2-x,x-t1)
    s2t2 = max(s2-x,t2-x)
    print(min(s1t1,s1t2,s2t1,s2t2))

for i in range(q):
    x = ni()
    solve(x)
