import bisect
A,B,Q =list(map(int,input().split()))
s = []
t = []
for i in range(A):
    s.append(int(input()))
for i in range(B):
    t.append(int(input()))
for i in range(Q):
    x=(int(input()))    
    s_index_af = bisect.bisect(s,x)
    if s_index_af == A:
        s_index_af -= 1
        s_index_bf = s_index_af
    else:
        s_index_bf = s_index_af -1

    t_index_af = bisect.bisect(t,x)
    if t_index_af == B:
        t_index_af -= 1
        t_index_bf = t_index_af
    else:
        t_index_bf = t_index_af -1
   
    jl = [s[s_index_bf]-x,s[s_index_af]-x]
    tl = [t[t_index_bf]-x,t[t_index_af]-x]

    jt = []
    jt.append(abs(jl[0])+abs(tl[0]-jl[0]))
    jt.append(abs(jl[0])+abs(tl[1]-jl[0]))
    jt.append(abs(jl[1])+abs(tl[0]-jl[1]))
    jt.append(abs(jl[1])+abs(tl[1]-jl[1]))

    jt.append(abs(tl[0])+abs(jl[0]-tl[0]))
    jt.append(abs(tl[0])+abs(jl[1]-tl[0]))
    jt.append(abs(tl[1])+abs(jl[0]-tl[1]))
    jt.append(abs(tl[1])+abs(jl[1]-tl[1]))

            
    print(min(jt)) import bisect bisect A,B,Q =list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B Q s = [] s [] t = [] t [] for i in range(A):
    s.append(int(input())) i range(A) range A s.append(int(input())) s.append s append int(input()) int input() input for i in range(B):
    t.append(int(input())) i range(B) range B t.append(int(input())) t.append t append int(input()) int input() input for i in range(Q):
    x=(int(input()))    
    s_index_af = bisect.bisect(s,x)
    if s_index_af == A:
        s_index_af -= 1
        s_index_bf = s_index_af
    else:
        s_index_bf = s_index_af -1

    t_index_af = bisect.bisect(t,x)
    if t_index_af == B:
        t_index_af -= 1
        t_index_bf = t_index_af
    else:
        t_index_bf = t_index_af -1
   
    jl = [s[s_index_bf]-x,s[s_index_af]-x]
    tl = [t[t_index_bf]-x,t[t_index_af]-x]

    jt = []
    jt.append(abs(jl[0])+abs(tl[0]-jl[0]))
    jt.append(abs(jl[0])+abs(tl[1]-jl[0]))
    jt.append(abs(jl[1])+abs(tl[0]-jl[1]))
    jt.append(abs(jl[1])+abs(tl[1]-jl[1]))

    jt.append(abs(tl[0])+abs(jl[0]-tl[0]))
    jt.append(abs(tl[0])+abs(jl[1]-tl[0]))
    jt.append(abs(tl[1])+abs(jl[0]-tl[1]))
    jt.append(abs(tl[1])+abs(jl[1]-tl[1]))

            
    print(min(jt)) i range(Q) range Q x=(int(input())) x int(input()) int input() input s_index_af = bisect.bisect(s,x) s_index_af bisect.bisect(s,x) bisect.bisect bisect bisect s x if s_index_af == A:
        s_index_af -= 1
        s_index_bf = s_index_af
    else:
        s_index_bf = s_index_af -1

     s_index_af == A s_index_af A s_index_af -= 1 s_index_af 1 s_index_bf = s_index_af s_index_bf s_index_af s_index_bf = s_index_af -1 s_index_bf s_index_af -1 s_index_af 1 t_index_af = bisect.bisect(t,x) t_index_af bisect.bisect(t,x) bisect.bisect bisect bisect t x if t_index_af == B:
        t_index_af -= 1
        t_index_bf = t_index_af
    else:
        t_index_bf = t_index_af -1
   
     t_index_af == B t_index_af B t_index_af -= 1 t_index_af 1 t_index_bf = t_index_af t_index_bf t_index_af t_index_bf = t_index_af -1 t_index_bf t_index_af -1 t_index_af 1 jl = [s[s_index_bf]-x,s[s_index_af]-x] jl [s[s_index_bf]-x,s[s_index_af]-x] s[s_index_bf]-x s[s_index_bf] s s_index_bf x s[s_index_af]-x s[s_index_af] s s_index_af x tl = [t[t_index_bf]-x,t[t_index_af]-x] tl [t[t_index_bf]-x,t[t_index_af]-x] t[t_index_bf]-x t[t_index_bf] t t_index_bf x t[t_index_af]-x t[t_index_af] t t_index_af x jt = [] jt [] jt.append(abs(jl[0])+abs(tl[0]-jl[0])) jt.append jt append abs(jl[0])+abs(tl[0]-jl[0]) abs(jl[0]) abs jl[0] jl 0 abs(tl[0]-jl[0]) abs tl[0]-jl[0] tl[0] tl 0 jl[0] jl 0 jt.append(abs(jl[0])+abs(tl[1]-jl[0])) jt.append jt append abs(jl[0])+abs(tl[1]-jl[0]) abs(jl[0]) abs jl[0] jl 0 abs(tl[1]-jl[0]) abs tl[1]-jl[0] tl[1] tl 1 jl[0] jl 0 jt.append(abs(jl[1])+abs(tl[0]-jl[1])) jt.append jt append abs(jl[1])+abs(tl[0]-jl[1]) abs(jl[1]) abs jl[1] jl 1 abs(tl[0]-jl[1]) abs tl[0]-jl[1] tl[0] tl 0 jl[1] jl 1 jt.append(abs(jl[1])+abs(tl[1]-jl[1])) jt.append jt append abs(jl[1])+abs(tl[1]-jl[1]) abs(jl[1]) abs jl[1] jl 1 abs(tl[1]-jl[1]) abs tl[1]-jl[1] tl[1] tl 1 jl[1] jl 1 jt.append(abs(tl[0])+abs(jl[0]-tl[0])) jt.append jt append abs(tl[0])+abs(jl[0]-tl[0]) abs(tl[0]) abs tl[0] tl 0 abs(jl[0]-tl[0]) abs jl[0]-tl[0] jl[0] jl 0 tl[0] tl 0 jt.append(abs(tl[0])+abs(jl[1]-tl[0])) jt.append jt append abs(tl[0])+abs(jl[1]-tl[0]) abs(tl[0]) abs tl[0] tl 0 abs(jl[1]-tl[0]) abs jl[1]-tl[0] jl[1] jl 1 tl[0] tl 0 jt.append(abs(tl[1])+abs(jl[0]-tl[1])) jt.append jt append abs(tl[1])+abs(jl[0]-tl[1]) abs(tl[1]) abs tl[1] tl 1 abs(jl[0]-tl[1]) abs jl[0]-tl[1] jl[0] jl 0 tl[1] tl 1 jt.append(abs(tl[1])+abs(jl[1]-tl[1])) jt.append jt append abs(tl[1])+abs(jl[1]-tl[1]) abs(tl[1]) abs tl[1] tl 1 abs(jl[1]-tl[1]) abs jl[1]-tl[1] jl[1] jl 1 tl[1] tl 1 print(min(jt)) print min(jt) min jt t_index_af -= 1 1 t_index_af t_index_bf = t_index_af -1 t_index_af -1 t_index_bf t_index_bf = t_index_af t_index_af t_index_bf s_index_af -= 1 1 s_index_af t_index_af = bisect.bisect(t,x) bisect.bisect(t,x) t_index_af B,Q =list(map(int,input().split())) list(map(int,input().split())) B x=(int(input())) int(input()) x tl = [t[t_index_bf]-x,t[t_index_af]-x] [t[t_index_bf]-x,t[t_index_af]-x] tl jl = [s[s_index_bf]-x,s[s_index_af]-x] [s[s_index_bf]-x,s[s_index_af]-x] jl Q =list(map(int,input().split())) list(map(int,input().split())) Q s = [] [] s s_index_bf = s_index_af -1 s_index_af -1 s_index_bf s_index_bf = s_index_af s_index_af s_index_bf t = [] [] t s_index_af = bisect.bisect(s,x) bisect.bisect(s,x) s_index_af A,B,Q =list(map(int,input().split())) list(map(int,input().split())) A jt = [] [] jt
import bisect
A,B,Q =list(map(int,input().split()))
s = []
t = []
for i in range(A):
    s.append(int(input()))
for i in range(B):
    t.append(int(input()))
for i in range(Q):
    x=(int(input()))    
    s_index_af = bisect.bisect(s,x)
    if s_index_af == A:
        s_index_af -= 1
        s_index_bf = s_index_af
    else:
        s_index_bf = s_index_af -1

    t_index_af = bisect.bisect(t,x)
    if t_index_af == B:
        t_index_af -= 1
        t_index_bf = t_index_af
    else:
        t_index_bf = t_index_af -1
   
    jl = [s[s_index_bf]-x,s[s_index_af]-x]
    tl = [t[t_index_bf]-x,t[t_index_af]-x]

    jt = []
    jt.append(abs(jl[0])+abs(tl[0]-jl[0]))
    jt.append(abs(jl[0])+abs(tl[1]-jl[0]))
    jt.append(abs(jl[1])+abs(tl[0]-jl[1]))
    jt.append(abs(jl[1])+abs(tl[1]-jl[1]))

    jt.append(abs(tl[0])+abs(jl[0]-tl[0]))
    jt.append(abs(tl[0])+abs(jl[1]-tl[0]))
    jt.append(abs(tl[1])+abs(jl[0]-tl[1]))
    jt.append(abs(tl[1])+abs(jl[1]-tl[1]))

            
    print(min(jt))
