import sys

import bisect

a, b, q = [int(i) for i in sys.stdin.readline().split()]

s_ls = []

t_ls = []

INF = 10 ** 18

for i in range(a):

    s = int(eval(input()))

    s_ls.append(s)

for i in range(b):

    t = int(eval(input()))

    t_ls.append(t)



for i in range(q):

    x = int(eval(input()))

    s_ind = min(bisect.bisect_left(s_ls, x), a-1)

    t_ind = min(bisect.bisect_left(t_ls, x), b-1)

    best = INF

    for _s in [-1, 0]:

        if s_ind == 0 and _s == -1:

            continue

        for _t in [-1, 0]:

            if t_ind == 0 and _t == -1:

                continue

            s = s_ls[s_ind + _s]

            t = t_ls[t_ind + _t]

            if (s - x) * (t - x) >= 0:

                dis = max(abs(t - x), abs(s - x))

            else:

                dis = min(abs(t - x), abs(s - x)) * 2 + max(abs(t - x), abs(s - x))

            best = min(dis, best)

    print(best)
import sys

import bisect

_input = sys.stdin.readlines()

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

data = [int(i) for i in _input[1:]]

s_ls = data[:a]

t_ls = data[a:a+b]

x_ls = data[-q:]

INF = 10 ** 18



for x in x_ls:

    s_ind = min(bisect.bisect_left(s_ls, x), a-1)

    t_ind = min(bisect.bisect_left(t_ls, x), b-1)

    best = INF

    for _s in [-1, 0]:

        if s_ind == 0 and _s == -1:

            continue

        for _t in [-1, 0]:

            if t_ind == 0 and _t == -1:

                continue

            s = s_ls[s_ind + _s]

            t = t_ls[t_ind + _t]

            if (s - x) * (t - x) >= 0:

                dis = max(abs(t - x), abs(s - x))

            else:

                dis = min(abs(t - x), abs(s - x)) * 2 + max(abs(t - x), abs(s - x))

            best = min(dis, best)

    print(best)
import sys
import bisect

a, b, q = [int(i) for i in sys.stdin.readline().split()]
s_ls = []
t_ls = []
INF = 10**18
for i in range(a):
    s = int(eval(input()))
    s_ls.append(s)
for i in range(b):
    t = int(eval(input()))
    t_ls.append(t)
for i in range(q):
    x = int(eval(input()))
    s_ind = min(bisect.bisect_left(s_ls, x), a - 1)
    t_ind = min(bisect.bisect_left(t_ls, x), b - 1)
    best = INF
    for _s in [-1, 0]:
        if s_ind == 0 and _s == -1:
            continue
        for _t in [-1, 0]:
            if t_ind == 0 and _t == -1:
                continue
            s = s_ls[s_ind + _s]
            t = t_ls[t_ind + _t]
            if (s - x) * (t - x) >= 0:
                dis = max(abs(t - x), abs(s - x))
            else:
                dis = min(abs(t - x), abs(s - x)) * 2 + max(abs(t - x), abs(s - x))
            best = min(dis, best)
    print(best)

import sys
import bisect

_input = sys.stdin.readlines()
a, b, q = [int(i) for i in _input[0].split()]
data = [int(i) for i in _input[1:]]
s_ls = data[:a]
t_ls = data[a : a + b]
x_ls = data[-q:]
INF = 10**18
for x in x_ls:
    s_ind = min(bisect.bisect_left(s_ls, x), a - 1)
    t_ind = min(bisect.bisect_left(t_ls, x), b - 1)
    best = INF
    for _s in [-1, 0]:
        if s_ind == 0 and _s == -1:
            continue
        for _t in [-1, 0]:
            if t_ind == 0 and _t == -1:
                continue
            s = s_ls[s_ind + _s]
            t = t_ls[t_ind + _t]
            if (s - x) * (t - x) >= 0:
                dis = max(abs(t - x), abs(s - x))
            else:
                dis = min(abs(t - x), abs(s - x)) * 2 + max(abs(t - x), abs(s - x))
            best = min(dis, best)
    print(best)

-a, b, q = [int(i) for i in sys.stdin.readline().split()] -s_ls = [] -t_ls = [] +_input = sys.stdin.readlines() +a, b, q = [int(i) for i in _input[0].split()] +data = [int(i) for i in _input[1:]] +s_ls = data[:a] +t_ls = data[a : a + b] +x_ls = data[-q:] -for i in range(a): -    s = int(eval(input())) -    s_ls.append(s) -for i in range(b): -    t = int(eval(input())) -    t_ls.append(t) -for i in range(q): -    x = int(eval(input())) +for x in x_ls: