using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    struct Index : IEquatable<Index>
    {
        public int h;
        public int w;
        public Index(int i, int j)
        {
            this.h = i;
            this.w = j;
        }
        public bool Equals(Index other) => this.h == other.h && this.w == other.w;
    }
    public class Program
    {
        public object Calc()
        {
            var line = consoleReader.SplitInt32();
            var A = line[0];
            var B = line[1];
            var Q = line[2];
            var jinja = (new long[] { -1000000000000 }).Concat(consoleReader.RepeatInt64(A)).Concat(new[] { 1000000000000 }).ToArray();
            var tera = (new long[] { -1000000000000 }).Concat(consoleReader.RepeatInt64(B)).Concat(new[] { 1000000000000 }).ToArray();
            var xs = consoleReader.RepeatInt64(Q).ToArray();
            var res = new Dictionary<long, long>();

            int j = 1;
            int t = 1;
            foreach (var x in xs.OrderBy(i => i))
            {
                while (true)
                {
                    if (x < jinja[j])
                    {
                        while (x > tera[t]) t++;
                        res[x] = CalcPoint(x, tera[t - 1], tera[t], jinja[j - 1], jinja[j]);
                        break;
                    }
                    if (x < tera[t])
                    {
                        while (x > jinja[j]) j++;
                        res[x] = CalcPoint(x, tera[t - 1], tera[t], jinja[j - 1], jinja[j]);
                        break;
                    }
                    j++; t++;
                }
            }
            return string.Join("\n", xs.Select(x => res[x].ToString()));
        }

        long CalcPoint(long x, long tera1, long tera2, long jinja1, long jinja2)
        {
            long v;
            v = x - jinja1 + Math.Abs(jinja1 - tera1);
            v = Math.Min(v, x - jinja1 + Math.Abs(jinja1 - tera2));
            v = Math.Min(v, x - tera1 + Math.Abs(jinja1 - tera1));
            v = Math.Min(v, x - tera1 + Math.Abs(jinja2 - tera1));
            v = Math.Min(v, tera2 - x + Math.Abs(jinja1 - tera2));
            v = Math.Min(v, tera2 - x + Math.Abs(jinja2 - tera2));
            v = Math.Min(v, jinja2 - x + Math.Abs(jinja2 - tera1));
            v = Math.Min(v, jinja2 - x + Math.Abs(jinja2 - tera2));
            return v;
        }


        const int mod = 1000000007;
        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine();
        public int Int32() => int.Parse(String());
        public long Int64() => long.Parse(String());
        public ulong UInt64() => ulong.Parse(String());
        public double Double() => double.Parse(String());
        public string[] Split() => String().Split().ToArray();
        public int[] SplitInt32() => String().Split().Select(s => int.Parse(s)).ToArray();
        public long[] SplitInt64() => String().Split().Select(s => long.Parse(s)).ToArray();
        public ulong[] SplitUInt64() => String().Split().Select(s => ulong.Parse(s)).ToArray();
        public double[] SplitDouble() => String().Split().Select(s => double.Parse(s)).ToArray();

        public IEnumerable<string> Repeat(int count)
        {
            for (int i = 0; i < count; i++)
                yield return String();
        }
        public IEnumerable<int> RepeatInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Int32();
        }
        public IEnumerable<long> RepeatInt64(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Int64();
        }
        public IEnumerable<string[]> RepeatSplit(int count)
        {
            for (int i = 0; i < count; i++)
                yield return Split();
        }
        public IEnumerable<int[]> RepeatSplitInt32(int count)
        {
            for (int i = 0; i < count; i++)
                yield return SplitInt32();
        }
    }
    static class DicExt
    {
        public static V GetOrDefault<K, V>(this Dictionary<K, V> dic, K key, V defaultValue = default(V))
        {
            V val;
            return dic.TryGetValue(key, out val) ? val : defaultValue;
        }
    }
}


Measured memory_bytes: 35540