# Original solution
a,b,q=list(map(int,input().split(' ')))
s=[]
t=[]
for i in range(a):
    s.append(int(eval(input())))
for i in range(b):
    t.append(int(eval(input())))
s.sort()
t.sort()
for i in range(q):
    x=int(eval(input()))
    n=x
    start=0
    end=a-1
    count=0
    mid=start+(end-start)//2
    while start<end:
        if s[mid]==x:
            break
        elif s[mid]>x:
            end=mid
            mid=start+(end-start)//2
        else:
            start=mid+1
            mid=start+(end-start)//2
    if s[mid]==x:
        count=0
    elif s[mid]>x:
        if mid>0:
            count+=min(s[mid]-x,x-s[mid-1])
            if s[mid]-x>x-s[mid-1]:
                x=s[mid-1]
            else:
                x=s[mid]
        else:
            count+=s[mid]-x
            x=s[mid]
    else:
        if mid<a-1:
            count+=min(x-s[mid],s[mid+1]-x)
            if x-s[mid]>s[mid+1]-x:
                x=s[mid+1]
            else:
                x=s[mid]
        else:
            count+=x-s[mid]
            x=s[mid]
    #print(count,x)
    start=0
    end=b-1
    mid=start+(end-start)//2
    while start<end:
        if t[mid]==x:
            break
        elif t[mid]>x:
            end=mid
            mid=start+(end-start)//2
        else:
            start=mid+1
            mid=start+(end-start)//2
   # print(mid)
    if t[mid]==x:
        pass
    elif t[mid]>x :
        if mid>0:
            count+=min(t[mid]-x,x-t[mid-1])
        else:
            count+=t[mid]-x
    else:
        if mid<b-1:
            count+=min(x-t[mid],t[mid+1]-x)
        else:
            count+=x-t[mid]
    start=0
    end=b-1
    count1=0
    x=n
    mid=start+(end-start)//2
    while start<end:
        if t[mid]==x:
            break
        elif t[mid]>x:
            end=mid
            mid=start+(end-start)//2
        else:
            start=mid+1
            mid=start+(end-start)//2
    if t[mid]==x:
        count1=0
    elif t[mid]>x:
        if mid>0:
            count1+=min(t[mid]-x,x-t[mid-1])
            if t[mid]-x>x-t[mid-1]:
                x=t[mid-1]
            else:
                x=t[mid]
        else:
            count1+=t[mid]-x
            x=t[mid]
    else:
        if mid<b-1:
            count1+=min(x-t[mid],t[mid+1]-x)
            if x-t[mid]>t[mid+1]-x:
                x=t[mid+1]
            else:
                x=t[mid]
        else:
            count1+=x-t[mid]
            x=t[mid]
    #print(count1,x)
    start=0
    end=a-1
    mid=start+(end-start)//2
    while start<end:
        if s[mid]==x:
            break
        elif s[mid]>x:
            end=mid
            mid=start+(end-start)//2
        else:
            start=mid+1
            mid=start+(end-start)//2
    if s[mid]==x:
        pass
    elif s[mid]>x :
        if mid>0:
            count1+=min(s[mid]-x,x-s[mid-1])
        else:
            count1+=s[mid]-x

    else:
        if mid<a-1:
            count1+=min(x-s[mid],s[mid+1]-x)
        else:
            count1+=x-s[mid]
    print((min(count,count1)))
            


# Optimized solution
import bisect
a,b,q=list(map(int,input().split(' ')))
INF=10**19
s=[-INF]+[int(eval(input())) for i in range(a)]+[INF]
t=[-INF]+[int(eval(input())) for i in range(b)]+[INF]
s.sort()
t.sort()
for i in range(q):
    x=int(eval(input()))
    b,d=bisect.bisect(s,x),bisect.bisect(t,x)
    mi=INF
    for j in [s[b-1],s[b]]:
        for k in [t[d-1],t[d]]:
            mi=min(mi,abs(j-x)+abs(j-k),abs(k-x)+abs(j-k))
    print(mi)