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]

ans = []

for i in range(q):

    x = int(eval(input()))

    idxs = bisect.bisect(s, x)

    idxt = bisect.bisect(t, x)

    lis = []

    lis.append(x - min(s[idxs - 1], t[idxt -1]))

    lis.append(x - s[idxs - 1] + (t[idxt] - s[idxs - 1]))

    lis.append(t[idxt] - x + (t[idxt] - s[idxs - 1]))

    lis.append(x - t[idxt - 1] + (s[idxs] - t[idxt - 1]))

    lis.append(s[idxs] - x + (s[idxs] - t[idxt - 1]))

    lis.append(max(s[idxs], t[idxt]) - x)

    ans.append(min(lis))

for i in range(q):

    print((ans[i]))







import bisect

import sys

input = sys.stdin.readline

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]

ans = []

for i in range(q):

    x = int(eval(input()))

    idxs = bisect.bisect(s, x)

    idxt = bisect.bisect(t, x)

    lis = []

    lis.append(x - min(s[idxs - 1], t[idxt -1]))

    lis.append(x - s[idxs - 1] + (t[idxt] - s[idxs - 1]))

    lis.append(t[idxt] - x + (t[idxt] - s[idxs - 1]))

    lis.append(x - t[idxt - 1] + (s[idxs] - t[idxt - 1]))

    lis.append(s[idxs] - x + (s[idxs] - t[idxt - 1]))

    lis.append(max(s[idxs], t[idxt]) - x)

    ans.append(min(lis))

for i in range(q):

    print((ans[i]))







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]
ans = []
for i in range(q):
    x = int(eval(input()))
    idxs = bisect.bisect(s, x)
    idxt = bisect.bisect(t, x)
    lis = []
    lis.append(x - min(s[idxs - 1], t[idxt - 1]))
    lis.append(x - s[idxs - 1] + (t[idxt] - s[idxs - 1]))
    lis.append(t[idxt] - x + (t[idxt] - s[idxs - 1]))
    lis.append(x - t[idxt - 1] + (s[idxs] - t[idxt - 1]))
    lis.append(s[idxs] - x + (s[idxs] - t[idxt - 1]))
    lis.append(max(s[idxs], t[idxt]) - x)
    ans.append(min(lis))
for i in range(q):
    print((ans[i]))

import bisect
import sys

input = sys.stdin.readline
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]
ans = []
for i in range(q):
    x = int(eval(input()))
    idxs = bisect.bisect(s, x)
    idxt = bisect.bisect(t, x)
    lis = []
    lis.append(x - min(s[idxs - 1], t[idxt - 1]))
    lis.append(x - s[idxs - 1] + (t[idxt] - s[idxs - 1]))
    lis.append(t[idxt] - x + (t[idxt] - s[idxs - 1]))
    lis.append(x - t[idxt - 1] + (s[idxs] - t[idxt - 1]))
    lis.append(s[idxs] - x + (s[idxs] - t[idxt - 1]))
    lis.append(max(s[idxs], t[idxt]) - x)
    ans.append(min(lis))
for i in range(q):
    print((ans[i]))

+import sys +input = sys.stdin.readline