using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var abq = Input.ar;
        var shi = new List<long>();
        var tem= new List<long>();
        shi.Add(-(long)1e11);
        shi.AddRange(Enumerable.Repeat(0, abq[0]).Select(v => Input.numL));
        shi.Add((long)1e11);
        tem.Add(-(long)1e11);
        tem.AddRange(Enumerable.Repeat(0, abq[1]).Select(v => Input.numL));
        tem.Add((long)1e11);
        var ars = shi.ToArray();
        var art = tem.ToArray();
        var res = new long[abq[2]];
        for (var i = 0; i < abq[2]; i++)
        {
            var val = long.MaxValue;
            var x = Input.numL;
            var js = Search.UpperBound(ars, x);
            var jt = Search.UpperBound(art, x);
            val = Min(val, Max(shi[js], tem[jt]) - x);
            val = Min(val, x - Min(shi[js - 1], tem[jt - 1]));
            val = Min(val, shi[js] - tem[jt - 1] + Min(x - tem[jt - 1], shi[js] - x));
            val = Min(val, tem[jt] - shi[js - 1] + Min(x - shi[js - 1], tem[jt] - x));
            res[i] = val;
        }
        WriteLine(string.Join("\n", res));
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}

public class Search
{
    public static int UpperBound<T>(T[] array,T value)
        where T:IComparable<T>
    {
        var low = 0;
        var high = array.Length;
        while (high > low)
        {
            var mid = (high + low) / 2;
            if (array[mid].CompareTo(value) == 1) high = mid;
            else low = mid + 1;
        }
        return low;
    }

    public static int LowerBound<T>(T[] array,T value)
        where T : IComparable<T>
    {
        var low = 0;
        var high = array.Length;
        while (high > low)
        {
            var mid = (high + low) / 2;
            if (array[mid].CompareTo(value) != -1) high = mid;
            else low = mid + 1;
        }
        return low;
    }

    public static T Max<T>(params T[] array)
        => array.Max();
    public static T Min<T>(params T[] array)
        => array.Min();
    public static bool IsInside(int h, int w, int[] hw)
        => 0 <= h && h < hw[0] && 0 <= w && w < hw[1];
    public static bool IsPrime(long num)
    {
        if (num % 2 == 0 || num == 1) return num == 2;
        for (var i = 3; i * i <= num; i += 2)
            if (num % i == 0) return false;
        return true;
    }
}


Measured memory_bytes: 29008