from bisect import bisect_left
import sys
def input():
    return sys.stdin.readline()[:-1]
A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
for i in range(Q):
    x=int(input())
    si=bisect_left(s,x)
    ti=bisect_left(t,x)
    a=[]
    if si and si!=A:
        sl=s[si-1]
        sr=s[si]
    elif si:
        sl=s[-1]
        sr=0
    else:
        sl=0
        sr=s[0]
    if ti and ti!=B:
        tl=t[ti-1]
        tr=t[ti]
    elif ti:
        tl=t[-1]
        tr=0
    else:
        tl=0
        tr=t[0]
    if sl and tl:
        a.append(x-min(sl,tl))
    if sr and tr:
        a.append(max(tr,sr)-x)
    if sl and tr:
        a.append(tr-x+tr-sl)
        a.append(x-sl+tr-sl)
    if sr and tl:
        a.append(x-tl+sr-tl)
        a.append(sr-x+sr-tl)
    print(min(a)) from bisect import bisect_left import sys sys def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 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)] for i in range(Q):
    x=int(input())
    si=bisect_left(s,x)
    ti=bisect_left(t,x)
    a=[]
    if si and si!=A:
        sl=s[si-1]
        sr=s[si]
    elif si:
        sl=s[-1]
        sr=0
    else:
        sl=0
        sr=s[0]
    if ti and ti!=B:
        tl=t[ti-1]
        tr=t[ti]
    elif ti:
        tl=t[-1]
        tr=0
    else:
        tl=0
        tr=t[0]
    if sl and tl:
        a.append(x-min(sl,tl))
    if sr and tr:
        a.append(max(tr,sr)-x)
    if sl and tr:
        a.append(tr-x+tr-sl)
        a.append(x-sl+tr-sl)
    if sr and tl:
        a.append(x-tl+sr-tl)
        a.append(sr-x+sr-tl)
    print(min(a)) i range(Q) range Q x=int(input()) x int(input()) int input() input si=bisect_left(s,x) si bisect_left(s,x) bisect_left s x ti=bisect_left(t,x) ti bisect_left(t,x) bisect_left t x a=[] a [] if si and si!=A:
        sl=s[si-1]
        sr=s[si]
    elif si:
        sl=s[-1]
        sr=0
    else:
        sl=0
        sr=s[0]
     si and si!=A si si!=A si A sl=s[si-1] sl s[si-1] s si-1 si 1 sr=s[si] sr s[si] s si elif si:
        sl=s[-1]
        sr=0
     si sl=s[-1] sl s[-1] s -1 sr=0 sr 0 sl=0 sl 0 sr=s[0] sr s[0] s 0 if ti and ti!=B:
        tl=t[ti-1]
        tr=t[ti]
    elif ti:
        tl=t[-1]
        tr=0
    else:
        tl=0
        tr=t[0]
     ti and ti!=B ti ti!=B ti B tl=t[ti-1] tl t[ti-1] t ti-1 ti 1 tr=t[ti] tr t[ti] t ti elif ti:
        tl=t[-1]
        tr=0
     ti tl=t[-1] tl t[-1] t -1 tr=0 tr 0 tl=0 tl 0 tr=t[0] tr t[0] t 0 if sl and tl:
        a.append(x-min(sl,tl))
     sl and tl sl tl a.append(x-min(sl,tl)) a.append a append x-min(sl,tl) x min(sl,tl) min sl tl if sr and tr:
        a.append(max(tr,sr)-x)
     sr and tr sr tr a.append(max(tr,sr)-x) a.append a append max(tr,sr)-x max(tr,sr) max tr sr x if sl and tr:
        a.append(tr-x+tr-sl)
        a.append(x-sl+tr-sl)
     sl and tr sl tr a.append(tr-x+tr-sl) a.append a append tr-x+tr-sl tr-x+tr tr-x tr x tr sl a.append(x-sl+tr-sl) a.append a append x-sl+tr-sl x-sl+tr x-sl x sl tr sl if sr and tl:
        a.append(x-tl+sr-tl)
        a.append(sr-x+sr-tl)
     sr and tl sr tl a.append(x-tl+sr-tl) a.append a append x-tl+sr-tl x-tl+sr x-tl x tl sr tl a.append(sr-x+sr-tl) a.append a append sr-x+sr-tl sr-x+sr sr-x sr x sr tl print(min(a)) print min(a) min a sl=0 0 sl sr=s[si] s[si] sr tr=t[0] t[0] tr x=int(input()) int(input()) x tl=0 0 tl s=[int(input()) for i in range(A)] [int(input()) for i in range(A)] s t=[int(input()) for i in range(B)] [int(input()) for i in range(B)] t sr=0 0 sr sl=s[si-1] s[si-1] sl Q=map(int,input().split()) map(int,input().split()) Q a=[] [] a A,B,Q=map(int,input().split()) map(int,input().split()) A sr=s[0] s[0] sr tl=t[-1] t[-1] tl ti=bisect_left(t,x) bisect_left(t,x) ti tl=t[ti-1] t[ti-1] tl tr=0 0 tr def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input si=bisect_left(s,x) bisect_left(s,x) si B,Q=map(int,input().split()) map(int,input().split()) B tr=t[ti] t[ti] tr sl=s[-1] s[-1] sl
from bisect import bisect_left
import sys
def input():
    return sys.stdin.readline()[:-1]
A,B,Q=map(int,input().split())
s=[int(input()) for i in range(A)]
t=[int(input()) for i in range(B)]
for i in range(Q):
    x=int(input())
    si=bisect_left(s,x)
    ti=bisect_left(t,x)
    a=[]
    if si and si!=A:
        sl=s[si-1]
        sr=s[si]
    elif si:
        sl=s[-1]
        sr=0
    else:
        sl=0
        sr=s[0]
    if ti and ti!=B:
        tl=t[ti-1]
        tr=t[ti]
    elif ti:
        tl=t[-1]
        tr=0
    else:
        tl=0
        tr=t[0]
    if sl and tl:
        a.append(x-min(sl,tl))
    if sr and tr:
        a.append(max(tr,sr)-x)
    if sl and tr:
        a.append(tr-x+tr-sl)
        a.append(x-sl+tr-sl)
    if sr and tl:
        a.append(x-tl+sr-tl)
        a.append(sr-x+sr-tl)
    print(min(a))