from bisect import bisect_right
A,B,Q = map(int,input().split())
S = [int(input()) for _ in range(A)]
S.insert(0,-10**10)
S.append(2*10**10)
T = [int(input()) for _ in range(B)]
T.insert(0,-10**10)
T.append(2*20**10)
for _ in range(Q):
    x = int(input())
    inds = bisect_right(S,x)
    indt = bisect_right(T,x)
    dmin = 10**11
    d = x-S[inds-1]+abs(S[inds-1]-T[indt-1])
    dmin = min(dmin,d)
    d = x-S[inds-1]+abs(S[inds-1]-T[indt])
    dmin = min(dmin,d)
    d = S[inds]-x+abs(S[inds]-T[indt-1])
    dmin = min(dmin,d)
    d = S[inds]-x+abs(S[inds]-T[indt])
    dmin = min(dmin,d)
    d = x-T[indt-1]+abs(T[indt-1]-S[inds-1])
    dmin = min(dmin,d)
    d = x-T[indt-1]+abs(T[indt-1]-S[inds])
    dmin = min(dmin,d)
    d = T[indt]-x+abs(T[indt]-S[inds-1])
    dmin = min(dmin,d)
    d = T[indt]-x+abs(T[indt]-S[inds])
    dmin = min(dmin,d)
    print(dmin) from bisect import bisect_right 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)] S.insert(0,-10**10) S.insert S insert 0 -10**10 -10 10 S.append(2*10**10) S.append S append 2*10**10 2 10**10 10 10 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)] T.insert(0,-10**10) T.insert T insert 0 -10**10 -10 10 T.append(2*20**10) T.append T append 2*20**10 2 20**10 20 10 for _ in range(Q):
    x = int(input())
    inds = bisect_right(S,x)
    indt = bisect_right(T,x)
    dmin = 10**11
    d = x-S[inds-1]+abs(S[inds-1]-T[indt-1])
    dmin = min(dmin,d)
    d = x-S[inds-1]+abs(S[inds-1]-T[indt])
    dmin = min(dmin,d)
    d = S[inds]-x+abs(S[inds]-T[indt-1])
    dmin = min(dmin,d)
    d = S[inds]-x+abs(S[inds]-T[indt])
    dmin = min(dmin,d)
    d = x-T[indt-1]+abs(T[indt-1]-S[inds-1])
    dmin = min(dmin,d)
    d = x-T[indt-1]+abs(T[indt-1]-S[inds])
    dmin = min(dmin,d)
    d = T[indt]-x+abs(T[indt]-S[inds-1])
    dmin = min(dmin,d)
    d = T[indt]-x+abs(T[indt]-S[inds])
    dmin = min(dmin,d)
    print(dmin) _ range(Q) range Q x = int(input()) x int(input()) int input() input inds = bisect_right(S,x) inds bisect_right(S,x) bisect_right S x indt = bisect_right(T,x) indt bisect_right(T,x) bisect_right T x dmin = 10**11 dmin 10**11 10 11 d = x-S[inds-1]+abs(S[inds-1]-T[indt-1]) d x-S[inds-1]+abs(S[inds-1]-T[indt-1]) x-S[inds-1] x S[inds-1] S inds-1 inds 1 abs(S[inds-1]-T[indt-1]) abs S[inds-1]-T[indt-1] S[inds-1] S inds-1 inds 1 T[indt-1] T indt-1 indt 1 dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = x-S[inds-1]+abs(S[inds-1]-T[indt]) d x-S[inds-1]+abs(S[inds-1]-T[indt]) x-S[inds-1] x S[inds-1] S inds-1 inds 1 abs(S[inds-1]-T[indt]) abs S[inds-1]-T[indt] S[inds-1] S inds-1 inds 1 T[indt] T indt dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = S[inds]-x+abs(S[inds]-T[indt-1]) d S[inds]-x+abs(S[inds]-T[indt-1]) S[inds]-x S[inds] S inds x abs(S[inds]-T[indt-1]) abs S[inds]-T[indt-1] S[inds] S inds T[indt-1] T indt-1 indt 1 dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = S[inds]-x+abs(S[inds]-T[indt]) d S[inds]-x+abs(S[inds]-T[indt]) S[inds]-x S[inds] S inds x abs(S[inds]-T[indt]) abs S[inds]-T[indt] S[inds] S inds T[indt] T indt dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = x-T[indt-1]+abs(T[indt-1]-S[inds-1]) d x-T[indt-1]+abs(T[indt-1]-S[inds-1]) x-T[indt-1] x T[indt-1] T indt-1 indt 1 abs(T[indt-1]-S[inds-1]) abs T[indt-1]-S[inds-1] T[indt-1] T indt-1 indt 1 S[inds-1] S inds-1 inds 1 dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = x-T[indt-1]+abs(T[indt-1]-S[inds]) d x-T[indt-1]+abs(T[indt-1]-S[inds]) x-T[indt-1] x T[indt-1] T indt-1 indt 1 abs(T[indt-1]-S[inds]) abs T[indt-1]-S[inds] T[indt-1] T indt-1 indt 1 S[inds] S inds dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = T[indt]-x+abs(T[indt]-S[inds-1]) d T[indt]-x+abs(T[indt]-S[inds-1]) T[indt]-x T[indt] T indt x abs(T[indt]-S[inds-1]) abs T[indt]-S[inds-1] T[indt] T indt S[inds-1] S inds-1 inds 1 dmin = min(dmin,d) dmin min(dmin,d) min dmin d d = T[indt]-x+abs(T[indt]-S[inds]) d T[indt]-x+abs(T[indt]-S[inds]) T[indt]-x T[indt] T indt x abs(T[indt]-S[inds]) abs T[indt]-S[inds] T[indt] T indt S[inds] S inds dmin = min(dmin,d) dmin min(dmin,d) min dmin d print(dmin) print dmin d = S[inds]-x+abs(S[inds]-T[indt-1]) S[inds]-x+abs(S[inds]-T[indt-1]) d dmin = min(dmin,d) min(dmin,d) dmin S = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] S dmin = min(dmin,d) min(dmin,d) dmin d = S[inds]-x+abs(S[inds]-T[indt]) S[inds]-x+abs(S[inds]-T[indt]) d indt = bisect_right(T,x) bisect_right(T,x) indt dmin = min(dmin,d) min(dmin,d) dmin B,Q = map(int,input().split()) map(int,input().split()) B dmin = min(dmin,d) min(dmin,d) dmin A,B,Q = map(int,input().split()) map(int,input().split()) A dmin = min(dmin,d) min(dmin,d) dmin T = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] T dmin = min(dmin,d) min(dmin,d) dmin dmin = 10**11 10**11 dmin d = x-T[indt-1]+abs(T[indt-1]-S[inds]) x-T[indt-1]+abs(T[indt-1]-S[inds]) d x = int(input()) int(input()) x inds = bisect_right(S,x) bisect_right(S,x) inds dmin = min(dmin,d) min(dmin,d) dmin d = x-T[indt-1]+abs(T[indt-1]-S[inds-1]) x-T[indt-1]+abs(T[indt-1]-S[inds-1]) d dmin = min(dmin,d) min(dmin,d) dmin d = T[indt]-x+abs(T[indt]-S[inds]) T[indt]-x+abs(T[indt]-S[inds]) d d = x-S[inds-1]+abs(S[inds-1]-T[indt-1]) x-S[inds-1]+abs(S[inds-1]-T[indt-1]) d d = x-S[inds-1]+abs(S[inds-1]-T[indt]) x-S[inds-1]+abs(S[inds-1]-T[indt]) d Q = map(int,input().split()) map(int,input().split()) Q d = T[indt]-x+abs(T[indt]-S[inds-1]) T[indt]-x+abs(T[indt]-S[inds-1]) d
from bisect import bisect_right
A,B,Q = map(int,input().split())
S = [int(input()) for _ in range(A)]
S.insert(0,-10**10)
S.append(2*10**10)
T = [int(input()) for _ in range(B)]
T.insert(0,-10**10)
T.append(2*20**10)
for _ in range(Q):
    x = int(input())
    inds = bisect_right(S,x)
    indt = bisect_right(T,x)
    dmin = 10**11
    d = x-S[inds-1]+abs(S[inds-1]-T[indt-1])
    dmin = min(dmin,d)
    d = x-S[inds-1]+abs(S[inds-1]-T[indt])
    dmin = min(dmin,d)
    d = S[inds]-x+abs(S[inds]-T[indt-1])
    dmin = min(dmin,d)
    d = S[inds]-x+abs(S[inds]-T[indt])
    dmin = min(dmin,d)
    d = x-T[indt-1]+abs(T[indt-1]-S[inds-1])
    dmin = min(dmin,d)
    d = x-T[indt-1]+abs(T[indt-1]-S[inds])
    dmin = min(dmin,d)
    d = T[indt]-x+abs(T[indt]-S[inds-1])
    dmin = min(dmin,d)
    d = T[indt]-x+abs(T[indt]-S[inds])
    dmin = min(dmin,d)
    print(dmin)