from bisect import bisect_left

a, b, q = [int(i) for i in input().split()]

s_list = [int(input()) for _ in range(a)]
t_list = [int(input()) for _ in range(b)]

for _ in range(q):
    x = int(input())

    temp_s_t_list = [10 ** 11] * 4
    
    si = bisect_left(s_list, x)
    if si < a:
        temp_s_t_list[0] = s_list[si] - x
    if si > 0:
        temp_s_t_list[1] = s_list[si - 1] - x
    
    ti = bisect_left(t_list, x)
    if ti < b:
        temp_s_t_list[2] = t_list[ti] - x
    if ti > 0:
        temp_s_t_list[3] = t_list[ti - 1] - x

    ans = 10 ** 11 * 3
    for s_x, t_x in [(temp_s_t_list[0], temp_s_t_list[2]), (temp_s_t_list[0], temp_s_t_list[3]), (temp_s_t_list[1], temp_s_t_list[2]), (temp_s_t_list[1], temp_s_t_list[3])]:
        temp_s_x = s_x
        s_x = abs(s_x)
        temp_t_x = t_x
        t_x = abs(t_x)
        if temp_s_x // s_x == temp_t_x // t_x:
            temp = max(s_x, t_x)
        else:
            temp = s_x + t_x + min(s_x, t_x)

        if ans > temp:
            ans = temp
    print(ans) from bisect import bisect_left int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a, b, q = [int(i) for i in input().split()] a [int(i) for i in 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_list = [int(input()) for _ in range(a)] s_list [int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t_list = [int(input()) for _ in range(b)] t_list [int(input()) for _ in range(b)] for _ in range(q):
    x = int(input())

    temp_s_t_list = [10 ** 11] * 4
    
    si = bisect_left(s_list, x)
    if si < a:
        temp_s_t_list[0] = s_list[si] - x
    if si > 0:
        temp_s_t_list[1] = s_list[si - 1] - x
    
    ti = bisect_left(t_list, x)
    if ti < b:
        temp_s_t_list[2] = t_list[ti] - x
    if ti > 0:
        temp_s_t_list[3] = t_list[ti - 1] - x

    ans = 10 ** 11 * 3
    for s_x, t_x in [(temp_s_t_list[0], temp_s_t_list[2]), (temp_s_t_list[0], temp_s_t_list[3]), (temp_s_t_list[1], temp_s_t_list[2]), (temp_s_t_list[1], temp_s_t_list[3])]:
        temp_s_x = s_x
        s_x = abs(s_x)
        temp_t_x = t_x
        t_x = abs(t_x)
        if temp_s_x // s_x == temp_t_x // t_x:
            temp = max(s_x, t_x)
        else:
            temp = s_x + t_x + min(s_x, t_x)

        if ans > temp:
            ans = temp
    print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input temp_s_t_list = [10 ** 11] * 4 temp_s_t_list [10 ** 11] * 4 [10 ** 11] 10 ** 11 10 11 4 si = bisect_left(s_list, x) si bisect_left(s_list, x) bisect_left s_list x if si < a:
        temp_s_t_list[0] = s_list[si] - x
     si < a si a temp_s_t_list[0] = s_list[si] - x temp_s_t_list[0] temp_s_t_list 0 s_list[si] - x s_list[si] s_list si x if si > 0:
        temp_s_t_list[1] = s_list[si - 1] - x
    
     si > 0 si 0 temp_s_t_list[1] = s_list[si - 1] - x temp_s_t_list[1] temp_s_t_list 1 s_list[si - 1] - x s_list[si - 1] s_list si - 1 si 1 x ti = bisect_left(t_list, x) ti bisect_left(t_list, x) bisect_left t_list x if ti < b:
        temp_s_t_list[2] = t_list[ti] - x
     ti < b ti b temp_s_t_list[2] = t_list[ti] - x temp_s_t_list[2] temp_s_t_list 2 t_list[ti] - x t_list[ti] t_list ti x if ti > 0:
        temp_s_t_list[3] = t_list[ti - 1] - x

     ti > 0 ti 0 temp_s_t_list[3] = t_list[ti - 1] - x temp_s_t_list[3] temp_s_t_list 3 t_list[ti - 1] - x t_list[ti - 1] t_list ti - 1 ti 1 x ans = 10 ** 11 * 3 ans 10 ** 11 * 3 10 ** 11 10 11 3 for s_x, t_x in [(temp_s_t_list[0], temp_s_t_list[2]), (temp_s_t_list[0], temp_s_t_list[3]), (temp_s_t_list[1], temp_s_t_list[2]), (temp_s_t_list[1], temp_s_t_list[3])]:
        temp_s_x = s_x
        s_x = abs(s_x)
        temp_t_x = t_x
        t_x = abs(t_x)
        if temp_s_x // s_x == temp_t_x // t_x:
            temp = max(s_x, t_x)
        else:
            temp = s_x + t_x + min(s_x, t_x)

        if ans > temp:
            ans = temp
     s_x t_x [(temp_s_t_list[0], temp_s_t_list[2]), (temp_s_t_list[0], temp_s_t_list[3]), (temp_s_t_list[1], temp_s_t_list[2]), (temp_s_t_list[1], temp_s_t_list[3])] (temp_s_t_list[0], temp_s_t_list[2]) temp_s_t_list[0] temp_s_t_list 0 temp_s_t_list[2] temp_s_t_list 2 (temp_s_t_list[0], temp_s_t_list[3]) temp_s_t_list[0] temp_s_t_list 0 temp_s_t_list[3] temp_s_t_list 3 (temp_s_t_list[1], temp_s_t_list[2]) temp_s_t_list[1] temp_s_t_list 1 temp_s_t_list[2] temp_s_t_list 2 (temp_s_t_list[1], temp_s_t_list[3]) temp_s_t_list[1] temp_s_t_list 1 temp_s_t_list[3] temp_s_t_list 3 temp_s_x = s_x temp_s_x s_x s_x = abs(s_x) s_x abs(s_x) abs s_x temp_t_x = t_x temp_t_x t_x t_x = abs(t_x) t_x abs(t_x) abs t_x if temp_s_x // s_x == temp_t_x // t_x:
            temp = max(s_x, t_x)
        else:
            temp = s_x + t_x + min(s_x, t_x)

         temp_s_x // s_x == temp_t_x // t_x temp_s_x // s_x temp_s_x s_x temp_t_x // t_x temp_t_x t_x temp = max(s_x, t_x) temp max(s_x, t_x) max s_x t_x temp = s_x + t_x + min(s_x, t_x) temp s_x + t_x + min(s_x, t_x) s_x + t_x s_x t_x min(s_x, t_x) min s_x t_x if ans > temp:
            ans = temp
     ans > temp ans temp ans = temp ans temp print(ans) print ans q = [int(i) for i in input().split()] [int(i) for i in input().split()] q a, b, q = [int(i) for i in input().split()] [int(i) for i in input().split()] a temp = s_x + t_x + min(s_x, t_x) s_x + t_x + min(s_x, t_x) temp ans = temp temp ans temp_s_t_list = [10 ** 11] * 4 [10 ** 11] * 4 temp_s_t_list ans = 10 ** 11 * 3 10 ** 11 * 3 ans s_x = abs(s_x) abs(s_x) s_x temp_t_x = t_x t_x temp_t_x t_list = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] t_list ti = bisect_left(t_list, x) bisect_left(t_list, x) ti s_list = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] s_list x = int(input()) int(input()) x si = bisect_left(s_list, x) bisect_left(s_list, x) si temp = max(s_x, t_x) max(s_x, t_x) temp temp_s_x = s_x s_x temp_s_x b, q = [int(i) for i in input().split()] [int(i) for i in input().split()] b t_x = abs(t_x) abs(t_x) t_x
from bisect import bisect_left

a, b, q = [int(i) for i in input().split()]

s_list = [int(input()) for _ in range(a)]
t_list = [int(input()) for _ in range(b)]

for _ in range(q):
    x = int(input())

    temp_s_t_list = [10 ** 11] * 4
    
    si = bisect_left(s_list, x)
    if si < a:
        temp_s_t_list[0] = s_list[si] - x
    if si > 0:
        temp_s_t_list[1] = s_list[si - 1] - x
    
    ti = bisect_left(t_list, x)
    if ti < b:
        temp_s_t_list[2] = t_list[ti] - x
    if ti > 0:
        temp_s_t_list[3] = t_list[ti - 1] - x

    ans = 10 ** 11 * 3
    for s_x, t_x in [(temp_s_t_list[0], temp_s_t_list[2]), (temp_s_t_list[0], temp_s_t_list[3]), (temp_s_t_list[1], temp_s_t_list[2]), (temp_s_t_list[1], temp_s_t_list[3])]:
        temp_s_x = s_x
        s_x = abs(s_x)
        temp_t_x = t_x
        t_x = abs(t_x)
        if temp_s_x // s_x == temp_t_x // t_x:
            temp = max(s_x, t_x)
        else:
            temp = s_x + t_x + min(s_x, t_x)

        if ans > temp:
            ans = temp
    print(ans)