# https://img.atcoder.jp/abc119/editorial.pdf

# bisect_right ---> bisect_left

import bisect

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

INF = 10 ** 18

s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]

t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]

for q in range(Q):

    x = int(eval(input()))

    b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)

    res = INF

    for S in [s[b - 1], s[b]]:

        for T in [t[d - 1], t[d]]:

            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)

            res = min(res, d1, d2)

    print(res)

import sys

from bisect import bisect_left



input = sys.stdin.readline





def solve(Q, S, T, X):

    ans = [0] * Q

    INF = 10 ** 11

    for q, x in enumerate(X):

        min_dist = INF

        i_s = bisect_left(S, x)

        i_t = bisect_left(T, x)

        for s in (S[i_s - 1], S[i_s]):

            for t in (T[i_t - 1], T[i_t]):

                dist_s2t = abs(x - s) + abs(s - t)

                dist_t2s = abs(x - t) + abs(t - s)

                min_dist = min(min_dist, dist_s2t, dist_t2s)

        ans[q] = min_dist

    return ans





def main():

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

    S = [0] * (A + 2)

    T = [0] * (B + 2)

    X = [0] * Q

    for i in range(1, A + 1):

        S[i] = int(eval(input()))

    for i in range(1, B + 1):

        T[i] = int(eval(input()))

    for i in range(Q):

        X[i] = int(eval(input()))



    S[0] = T[0] = -10 ** 11

    S[-1] = T[-1] = 10 ** 11



    ans = solve(Q, S, T, X)

    print(("\n".join(map(str, ans))))





if __name__ == "__main__":

    main()

# https://img.atcoder.jp/abc119/editorial.pdf
# bisect_right ---> bisect_left
import bisect

A, B, Q = list(map(int, input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
for q in range(Q):
    x = int(eval(input()))
    b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x)
    res = INF
    for S in [s[b - 1], s[b]]:
        for T in [t[d - 1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)

import sys
from bisect import bisect_left

input = sys.stdin.readline


def solve(Q, S, T, X):
    ans = [0] * Q
    INF = 10**11
    for q, x in enumerate(X):
        min_dist = INF
        i_s = bisect_left(S, x)
        i_t = bisect_left(T, x)
        for s in (S[i_s - 1], S[i_s]):
            for t in (T[i_t - 1], T[i_t]):
                dist_s2t = abs(x - s) + abs(s - t)
                dist_t2s = abs(x - t) + abs(t - s)
                min_dist = min(min_dist, dist_s2t, dist_t2s)
        ans[q] = min_dist
    return ans


def main():
    A, B, Q = list(map(int, input().split()))
    S = [0] * (A + 2)
    T = [0] * (B + 2)
    X = [0] * Q
    for i in range(1, A + 1):
        S[i] = int(eval(input()))
    for i in range(1, B + 1):
        T[i] = int(eval(input()))
    for i in range(Q):
        X[i] = int(eval(input()))
    S[0] = T[0] = -(10**11)
    S[-1] = T[-1] = 10**11
    ans = solve(Q, S, T, X)
    print(("\n".join(map(str, ans))))


if __name__ == "__main__":
    main()

-# https://img.atcoder.jp/abc119/editorial.pdf -import bisect +import sys +from bisect import bisect_left -A, B, Q = list(map(int, input().split())) -INF = 10**18 -s = [-INF] + [int(eval(input())) for i in range(A)] + [INF] -t = [-INF] + [int(eval(input())) for i in range(B)] + [INF] -for q in range(Q): -    x = int(eval(input())) -    b, d = bisect.bisect_left(s, x), bisect.bisect_left(t, x) -    res = INF -    for S in [s[b - 1], s[b]]: -        for T in [t[d - 1], t[d]]: -            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T) -            res = min(res, d1, d2) -    print(res) +input = sys.stdin.readline + + +def solve(Q, S, T, X): +    ans = [0] * Q +    INF = 10**11 +    for q, x in enumerate(X): +        min_dist = INF +        i_s = bisect_left(S, x) +        i_t = bisect_left(T, x) +        for s in (S[i_s - 1], S[i_s]): +            for t in (T[i_t - 1], T[i_t]): +                dist_s2t = abs(x - s) + abs(s - t) +                dist_t2s = abs(x - t) + abs(t - s) +                min_dist = min(min_dist, dist_s2t, dist_t2s) +        ans[q] = min_dist +    return ans + + +def main(): +    A, B, Q = list(map(int, input().split())) +    S = [0] * (A + 2) +    T = [0] * (B + 2) +    X = [0] * Q +    for i in range(1, A + 1): +        S[i] = int(eval(input())) +    for i in range(1, B + 1): +        T[i] = int(eval(input())) +    for i in range(Q): +        X[i] = int(eval(input())) +    S[0] = T[0] = -(10**11) +    S[-1] = T[-1] = 10**11 +    ans = solve(Q, S, T, X) +    print(("\n".join(map(str, ans)))) + + +if __name__ == "__main__": +    main()