### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def getNearestIndexOf(query: int, s: "List[int]"):
    findTarget = s
    while len(findTarget) != 1:
        if len(findTarget) == 2:
            if abs(findTarget[0] - query) < abs(findTarget[1] - query):
                findTarget = [findTarget[0]]
            else:
                findTarget = [findTarget[1]]
            continue
        middle = int(len(findTarget)/2)
        if findTarget[middle] > query:
            findTarget = findTarget[0:middle + 1]
        else:
            findTarget = findTarget[middle:]
    #print(f"▫️{query} from {s} -> {findTarget[0]}")
    return findTarget[0]


def getCostByOrder(begin: int, s: "List[int]", t: "List[int]"):
    nc = 0
    nx = getNearestIndexOf(begin, t)
    nc += abs(nx-begin)
    nx2 = getNearestIndexOf(nx, s)
    nc += abs(nx2 - nx)
    return nc


def solve(A: int, B: int, Q: int, s: "List[int]", t: "List[int]", x: "List[int]"):
    for query in x:
        # 最初に神社に行く場合
        print(min(getCostByOrder(query, t, s), getCostByOrder(query, s, t)))
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    s = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    t = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    x = [int(next(tokens)) for _ in range(Q)]  # type: "List[int]"
    solve(A, B, Q, s, t, x)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import bisect


# def getNearestIndexOf(query: int, s: "List[int]"):
#     findTarget = s
#     while len(findTarget) != 1:
#         if len(findTarget) == 2:
#             if abs(findTarget[0] - query) < abs(findTarget[1] - query):
#                 findTarget = [findTarget[0]]
#             else:
#                 findTarget = [findTarget[1]]
#             continue
#         middle = int(len(findTarget)/2)
#         if findTarget[middle] > query:
#             findTarget = findTarget[0:middle + 1]
#         else:
#             findTarget = findTarget[middle:]
#     #print(f"▫️{query} from {s} -> {findTarget[0]}")
#     return findTarget[0]


# def getCostByOrder(begin: int, s: "List[int]", t: "List[int]"):
#     nc = 0
#     nx = bisect.b
#     nc += abs(nx-begin)
#     nx2 = getNearestIndexOf(nx, s)
#     nc += abs(nx2 - nx)
#     return nc


def solve(A: int, B: int, Q: int, s: "List[int]", t: "List[int]", x: "List[int]"):
    s = [-1 * 10**18] + s + [10**18]
    t = [-1 * 10**18] + t + [10 ** 18]
    for query in x:
        nearS = bisect.bisect_right(s, query)
        nearT = bisect.bisect_right(t, query)
        res = 10 ** 18
        for S in [s[nearS - 1], s[nearS]]:
            for T in [t[nearT - 1], t[nearT]]:
                d1 = abs(T - query) + abs(T - S)
                d2 = abs(S - query) + abs(T - S)
                res = min(res, d1, d2)
        print(res)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    s = [int(next(tokens)) for _ in range(A)]  # type: "List[int]"
    t = [int(next(tokens)) for _ in range(B)]  # type: "List[int]"
    x = [int(next(tokens)) for _ in range(Q)]  # type: "List[int]"
    solve(A, B, Q, s, t, x)


if __name__ == '__main__':
    main()