a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
x=[int(input()) for i in range(q)]
import bisect

inf=10**11

def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2

for i in range(q):
    now = x[i]
    ind,ind2 = tansak(s,t,now)
    if  ind==0:
        one=-inf
    else:
        one=s[ind-1]
    if ind==a:
        two=inf
    else:
        two=s[ind]
    if ind2==0:
        thr=-inf
    else:
        thr=t[ind2-1]
    if ind2==b:
        fo=inf
    else:
        fo=t[ind2]
    tmp1=max(two,fo)-now
    tmp2=2*two-thr-now
    tmp3=2*fo-one-now
    tmp4=now-min(one,thr)
    tmp5=now-thr+two-thr
    tmp6=now-one+fo-one
    print(min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6)) a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q int(input()) for i in range(a) for i in range(a) i range(a) range a for i in range(a) int(input()) int input() input s=[int(input()) for i in range(a)] s [int(input()) for i in range(a)] int(input()) for i in range(b) for i in range(b) i range(b) range b for i in range(b) int(input()) int input() input t=[int(input()) for i in range(b)] t [int(input()) for i in range(b)] int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input x=[int(input()) for i in range(q)] x [int(input()) for i in range(q)] import bisect bisect inf=10**11 inf 10**11 10 11 def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2 tansak ind=bisect.bisect_left(lis,dis) ind bisect.bisect_left(lis,dis) bisect.bisect_left bisect bisect_left lis dis ind2=bisect.bisect_left(lis2,dis) ind2 bisect.bisect_left(lis2,dis) bisect.bisect_left bisect bisect_left lis2 dis return ind,ind2 return ind,ind2 ind ind2 lis lis lis2 lis2 dis dis for i in range(q):
    now = x[i]
    ind,ind2 = tansak(s,t,now)
    if  ind==0:
        one=-inf
    else:
        one=s[ind-1]
    if ind==a:
        two=inf
    else:
        two=s[ind]
    if ind2==0:
        thr=-inf
    else:
        thr=t[ind2-1]
    if ind2==b:
        fo=inf
    else:
        fo=t[ind2]
    tmp1=max(two,fo)-now
    tmp2=2*two-thr-now
    tmp3=2*fo-one-now
    tmp4=now-min(one,thr)
    tmp5=now-thr+two-thr
    tmp6=now-one+fo-one
    print(min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6)) i range(q) range q now = x[i] now x[i] x i ind,ind2 = tansak(s,t,now) ind tansak(s,t,now) tansak s t now ind2 if  ind==0:
        one=-inf
    else:
        one=s[ind-1]
     ind==0 ind 0 one=-inf one -inf inf one=s[ind-1] one s[ind-1] s ind-1 ind 1 if ind==a:
        two=inf
    else:
        two=s[ind]
     ind==a ind a two=inf two inf two=s[ind] two s[ind] s ind if ind2==0:
        thr=-inf
    else:
        thr=t[ind2-1]
     ind2==0 ind2 0 thr=-inf thr -inf inf thr=t[ind2-1] thr t[ind2-1] t ind2-1 ind2 1 if ind2==b:
        fo=inf
    else:
        fo=t[ind2]
     ind2==b ind2 b fo=inf fo inf fo=t[ind2] fo t[ind2] t ind2 tmp1=max(two,fo)-now tmp1 max(two,fo)-now max(two,fo) max two fo now tmp2=2*two-thr-now tmp2 2*two-thr-now 2*two-thr 2*two 2 two thr now tmp3=2*fo-one-now tmp3 2*fo-one-now 2*fo-one 2*fo 2 fo one now tmp4=now-min(one,thr) tmp4 now-min(one,thr) now min(one,thr) min one thr tmp5=now-thr+two-thr tmp5 now-thr+two-thr now-thr+two now-thr now thr two thr tmp6=now-one+fo-one tmp6 now-one+fo-one now-one+fo now-one now one fo one print(min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6)) print min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6) min tmp1 tmp2 tmp3 tmp4 tmp5 tmp6 tmp5=now-thr+two-thr now-thr+two-thr tmp5 one=-inf -inf one tmp1=max(two,fo)-now max(two,fo)-now tmp1 thr=-inf -inf thr x=[int(input()) for i in range(q)] [int(input()) for i in range(q)] x t=[int(input()) for i in range(b)] [int(input()) for i in range(b)] t b,q=map(int,input().split()) map(int,input().split()) b ind2 = tansak(s,t,now) tansak(s,t,now) ind2 fo=inf inf fo two=inf inf two q=map(int,input().split()) map(int,input().split()) q inf=10**11 10**11 inf thr=t[ind2-1] t[ind2-1] thr fo=t[ind2] t[ind2] fo ind,ind2 = tansak(s,t,now) tansak(s,t,now) ind tmp2=2*two-thr-now 2*two-thr-now tmp2 tmp4=now-min(one,thr) now-min(one,thr) tmp4 a,b,q=map(int,input().split()) map(int,input().split()) a one=s[ind-1] s[ind-1] one s=[int(input()) for i in range(a)] [int(input()) for i in range(a)] s tmp3=2*fo-one-now 2*fo-one-now tmp3 tmp6=now-one+fo-one now-one+fo-one tmp6 two=s[ind] s[ind] two def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2 def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2 tansak now = x[i] x[i] now
a,b,q=map(int,input().split())
s=[int(input()) for i in range(a)]
t=[int(input()) for i in range(b)]
x=[int(input()) for i in range(q)]
import bisect

inf=10**11

def tansak(lis,lis2,dis):
    ind=bisect.bisect_left(lis,dis)
    ind2=bisect.bisect_left(lis2,dis)
    return ind,ind2

for i in range(q):
    now = x[i]
    ind,ind2 = tansak(s,t,now)
    if  ind==0:
        one=-inf
    else:
        one=s[ind-1]
    if ind==a:
        two=inf
    else:
        two=s[ind]
    if ind2==0:
        thr=-inf
    else:
        thr=t[ind2-1]
    if ind2==b:
        fo=inf
    else:
        fo=t[ind2]
    tmp1=max(two,fo)-now
    tmp2=2*two-thr-now
    tmp3=2*fo-one-now
    tmp4=now-min(one,thr)
    tmp5=now-thr+two-thr
    tmp6=now-one+fo-one
    print(min(tmp1,tmp2,tmp3,tmp4,tmp5,tmp6))
