A,B,Q = list(map(int, input().split()))

s = [-(10**11)]+[int(eval(input())) for _ in range(A)]+[10**11]

t = [-(10**11)]+[int(eval(input())) for _ in range(B)]+[10**11]

s.sort()

t.sort()



import bisect

import itertools

for _ in range(Q):

    pos = int(eval(input()))

    s_near_id = bisect.bisect_left(s, pos)-1

    t_near_id = bisect.bisect_left(t, pos)-1

    print((min( min(abs(pos-s_pos)+abs(s_pos-t_pos), abs(pos-t_pos)+abs(t_pos-s_pos)) for s_pos, t_pos in itertools.product(s[s_near_id:s_near_id+2],t[t_near_id:t_near_id+2]) )))

A,B,Q = list(map(int, input().split()))

s = [-(10**11)]+[int(eval(input())) for _ in range(A)]+[10**11]

t = [-(10**11)]+[int(eval(input())) for _ in range(B)]+[10**11]

s.sort()

t.sort()

 

import bisect

import itertools

for _ in range(Q):

    pos = int(eval(input()))

    near_s = bisect.bisect_left(s, pos)-1

    near_t = bisect.bisect_left(t, pos)-1

    s1, s2 = s[near_s], s[near_s+1]

    t1, t2 = t[near_t], t[near_t+1]

    print((min(

        pos - min(s1,t1),

        max(s2,t2) - pos,

        (s2 - pos) + (s2 - t1),

        (pos - t1) + (s2 - t1),

        (t2 - pos) + (t2 - s1),

        (pos - s1) + (t2 - s1)

    )))

A, B, Q = list(map(int, input().split()))
s = [-(10**11)] + [int(eval(input())) for _ in range(A)] + [10**11]
t = [-(10**11)] + [int(eval(input())) for _ in range(B)] + [10**11]
s.sort()
t.sort()
import bisect
import itertools

for _ in range(Q):
    pos = int(eval(input()))
    s_near_id = bisect.bisect_left(s, pos) - 1
    t_near_id = bisect.bisect_left(t, pos) - 1
    print(
        (
            min(
                min(
                    abs(pos - s_pos) + abs(s_pos - t_pos),
                    abs(pos - t_pos) + abs(t_pos - s_pos),
                )
                for s_pos, t_pos in itertools.product(
                    s[s_near_id : s_near_id + 2], t[t_near_id : t_near_id + 2]
                )
            )
        )
    )

A, B, Q = list(map(int, input().split()))
s = [-(10**11)] + [int(eval(input())) for _ in range(A)] + [10**11]
t = [-(10**11)] + [int(eval(input())) for _ in range(B)] + [10**11]
s.sort()
t.sort()
import bisect
import itertools

for _ in range(Q):
    pos = int(eval(input()))
    near_s = bisect.bisect_left(s, pos) - 1
    near_t = bisect.bisect_left(t, pos) - 1
    s1, s2 = s[near_s], s[near_s + 1]
    t1, t2 = t[near_t], t[near_t + 1]
    print(
        (
            min(
                pos - min(s1, t1),
                max(s2, t2) - pos,
                (s2 - pos) + (s2 - t1),
                (pos - t1) + (s2 - t1),
                (t2 - pos) + (t2 - s1),
                (pos - s1) + (t2 - s1),
            )
        )
    )

-    s_near_id = bisect.bisect_left(s, pos) - 1 -    t_near_id = bisect.bisect_left(t, pos) - 1 +    near_s = bisect.bisect_left(s, pos) - 1 +    near_t = bisect.bisect_left(t, pos) - 1 +    s1, s2 = s[near_s], s[near_s + 1] +    t1, t2 = t[near_t], t[near_t + 1] -                min( -                    abs(pos - s_pos) + abs(s_pos - t_pos), -                    abs(pos - t_pos) + abs(t_pos - s_pos), -                ) -                for s_pos, t_pos in itertools.product( -                    s[s_near_id : s_near_id + 2], t[t_near_id : t_near_id + 2] -                ) +                pos - min(s1, t1), +                max(s2, t2) - pos, +                (s2 - pos) + (s2 - t1), +                (pos - t1) + (s2 - t1), +                (t2 - pos) + (t2 - s1), +                (pos - s1) + (t2 - s1),