import sys

import bisect

from itertools import product

def input(): return sys.stdin.readline().strip()

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

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

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

stlist = [s,t]

ab = [A,B]

for i in range(Q):

    x = int(eval(input()))

    cand = []

    for i in range(2):

        st = stlist[i]

        cand1 = set()

        l1 = bisect.bisect_left(st,x)

        r1 = bisect.bisect_right(st,x)

        if 0 <= l1 <= ab[i]-1:

            cand1.add(st[l1])

        if 0 <= l1-1 <= ab[i]-1:

            cand1.add(st[l1-1])

        cand.append(cand1)

        

    ans = float('inf')

    for a,b in product(cand[0],cand[1]):

        c = min(abs(x-a)+abs(b-a),abs(x-b)+abs(b-a))

        ans = min(ans,c)

    print(ans)

        

        

    
import sys

import bisect

from itertools import product

def input(): return sys.stdin.readline().strip()

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

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

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

stlist = [s,t]

ab = [A,B]

for i in range(Q):

    x = int(eval(input()))

    cand = []

    for i in range(2):

        st = stlist[i]

        cand1 = set()

        l1 = bisect.bisect_left(st,x)

        if 0 <= l1 <= ab[i]-1:

            cand1.add(st[l1])

        if 0 <= l1-1 <= ab[i]-1:

            cand1.add(st[l1-1])

        cand.append(cand1)

    ans = float('inf')

    for a,b in product(cand[0],cand[1]):

        c = min(abs(x-a)+abs(b-a),abs(x-b)+abs(b-a))

        ans = min(ans,c)

    print(ans)

        

        

    
import sys
import bisect
from itertools import product


def input():
    return sys.stdin.readline().strip()


A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(A)]
t = [int(eval(input())) for i in range(B)]
stlist = [s, t]
ab = [A, B]
for i in range(Q):
    x = int(eval(input()))
    cand = []
    for i in range(2):
        st = stlist[i]
        cand1 = set()
        l1 = bisect.bisect_left(st, x)
        r1 = bisect.bisect_right(st, x)
        if 0 <= l1 <= ab[i] - 1:
            cand1.add(st[l1])
        if 0 <= l1 - 1 <= ab[i] - 1:
            cand1.add(st[l1 - 1])
        cand.append(cand1)
    ans = float("inf")
    for a, b in product(cand[0], cand[1]):
        c = min(abs(x - a) + abs(b - a), abs(x - b) + abs(b - a))
        ans = min(ans, c)
    print(ans)

import sys
import bisect
from itertools import product


def input():
    return sys.stdin.readline().strip()


A, B, Q = list(map(int, input().split()))
s = [int(eval(input())) for i in range(A)]
t = [int(eval(input())) for i in range(B)]
stlist = [s, t]
ab = [A, B]
for i in range(Q):
    x = int(eval(input()))
    cand = []
    for i in range(2):
        st = stlist[i]
        cand1 = set()
        l1 = bisect.bisect_left(st, x)
        if 0 <= l1 <= ab[i] - 1:
            cand1.add(st[l1])
        if 0 <= l1 - 1 <= ab[i] - 1:
            cand1.add(st[l1 - 1])
        cand.append(cand1)
    ans = float("inf")
    for a, b in product(cand[0], cand[1]):
        c = min(abs(x - a) + abs(b - a), abs(x - b) + abs(b - a))
        ans = min(ans, c)
    print(ans)

-        r1 = bisect.bisect_right(st, x)