import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for _ in range(a)] + [inf]
t = [-inf] + [int(input()) for _ in range(b)] + [inf]
#print(s)
#print(t)
for _ in range(q):
    start = int(input())
    x = bisect.bisect_right(s, start)
    y = bisect.bisect_right(t, start)
    ans = inf
    for i in [s[x], s[x-1]]:
        for j in [t[y], t[y-1]]:
            res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j))
            ans = min(ans, res)
    print(ans) import bisect bisect a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q inf = 10**18 inf 10**18 10 18 int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s = [-inf] + [int(input()) for _ in range(a)] + [inf] s [-inf] + [int(input()) for _ in range(a)] + [inf] [-inf] + [int(input()) for _ in range(a)] [-inf] -inf inf [int(input()) for _ in range(a)] [inf] inf int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [-inf] + [int(input()) for _ in range(b)] + [inf] t [-inf] + [int(input()) for _ in range(b)] + [inf] [-inf] + [int(input()) for _ in range(b)] [-inf] -inf inf [int(input()) for _ in range(b)] [inf] inf for _ in range(q):
    start = int(input())
    x = bisect.bisect_right(s, start)
    y = bisect.bisect_right(t, start)
    ans = inf
    for i in [s[x], s[x-1]]:
        for j in [t[y], t[y-1]]:
            res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j))
            ans = min(ans, res)
    print(ans) _ range(q) range q start = int(input()) start int(input()) int input() input x = bisect.bisect_right(s, start) x bisect.bisect_right(s, start) bisect.bisect_right bisect bisect_right s start y = bisect.bisect_right(t, start) y bisect.bisect_right(t, start) bisect.bisect_right bisect bisect_right t start ans = inf ans inf for i in [s[x], s[x-1]]:
        for j in [t[y], t[y-1]]:
            res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j))
            ans = min(ans, res)
     i [s[x], s[x-1]] s[x] s x s[x-1] s x-1 x 1 for j in [t[y], t[y-1]]:
            res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j))
            ans = min(ans, res)
     j [t[y], t[y-1]] t[y] t y t[y-1] t y-1 y 1 res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j)) res min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j)) min abs(i-start) + abs(j-i) abs(i-start) abs i-start i start abs(j-i) abs j-i j i abs(j-start) + abs(i-j) abs(j-start) abs j-start j start abs(i-j) abs i-j i j ans = min(ans, res) ans min(ans, res) min ans res print(ans) print ans a, b, q = map(int, input().split()) map(int, input().split()) a q = map(int, input().split()) map(int, input().split()) q ans = inf inf ans x = bisect.bisect_right(s, start) bisect.bisect_right(s, start) x ans = min(ans, res) min(ans, res) ans b, q = map(int, input().split()) map(int, input().split()) b t = [-inf] + [int(input()) for _ in range(b)] + [inf] [-inf] + [int(input()) for _ in range(b)] + [inf] t res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j)) min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j)) res start = int(input()) int(input()) start inf = 10**18 10**18 inf s = [-inf] + [int(input()) for _ in range(a)] + [inf] [-inf] + [int(input()) for _ in range(a)] + [inf] s y = bisect.bisect_right(t, start) bisect.bisect_right(t, start) y
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for _ in range(a)] + [inf]
t = [-inf] + [int(input()) for _ in range(b)] + [inf]
#print(s)
#print(t)
for _ in range(q):
    start = int(input())
    x = bisect.bisect_right(s, start)
    y = bisect.bisect_right(t, start)
    ans = inf
    for i in [s[x], s[x-1]]:
        for j in [t[y], t[y-1]]:
            res = min(abs(i-start) + abs(j-i), abs(j-start) + abs(i-j))
            ans = min(ans, res)
    print(ans)