#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) find(Range(c), x) != c.end()
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Vec2(T, n, m, xs) vector<vector<T>> xs(n, vector<T>(m))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, n, xs, sxs) vector<T> sxs(n+1); For(i, n) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, x) T x; cin >> x
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cout(x) cout << (x) << "\n"
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"

using namespace std;
using ll = long long;

int main(void){
    Cin(int, a);
    Cin(int, b);
    Cin(int, q);
    Cins(ll, a, s);
    Cins(ll, b, t);
    
    For(_, q){
        Cin(ll, x);
        ll ans = 1e11;
        
        // 神社 → 寺
        {
            int sl = -1, sr = a;
            while(sr - sl > 1){
                int m = (sl + sr) / 2;
                ((s[m] > x) ? sr : sl) = m;
            }
            // printf("s[%d] = %lld, s[%d] = %lld\n", sl, s[sl], sr, s[sr]);
            int tll = -1, tlr = b;
            while(tlr - tll > 1){
                int m = (tll + tlr) / 2;
                ((t[m] > s[sl]) ? tlr : tll) = m;
            }
            // printf("s[%d] = %lld, s[%d] = %lld\n", tll, t[tll], tlr, t[tlr]);
            int trl = -1, trr = b;
            while(trr - trl > 1){
                int m = (trl + trr) / 2;
                ((t[m] > s[sr]) ? trr : trl) = m;
            }
            // printf("s[%d] = %lld, s[%d] = %lld\n", trl, t[trl], trr, t[trr]);
            int tl = -1, tr = b;
            while(tr - tl > 1){
                int m = (tl + tr) / 2;
                ((t[m] > x) ? tr : tl) = m;
            }
            int sll = -1, slr = a;
            while(slr - sll > 1){
                int m = (sll + slr) / 2;
                ((s[m] > t[tl]) ? slr : sll) = m;
            }
            int srl = -1, srr = a;
            while(srr - srl > 1){
                int m = (srl + srr) / 2;
                ((s[m] > t[tr]) ? srr : srl) = m;
            }

            if(sl != -1 && tll != -1) ans = min(ans, x - t[tll]);
            if(sr != a && trr != b) ans = min(ans, t[trr] - x);
            if(sl != -1 && tlr != b) ans = min(ans, (t[tlr] < x) ? (x - s[sl]) : (x - s[sl] + t[tlr] - s[sl]));
            if(sr != a && trl != -1) ans = min(ans, (x < t[trl]) ? (s[sr] - x) : (s[sr] - x + s[sr] - t[trl]));
            if(tl != -1 && sll != -1) ans = min(ans, x - s[sll]);
            if(tr != b && srr != a) ans = min(ans, s[srr] - x);
            if(tl != -1 && slr != a) ans = min(ans, (s[slr] < x) ? (x - t[tl]) : (x - t[tl] + s[slr] - t[tl]));
            if(tr != b && srl != -1) ans = min(ans, (x < s[srl]) ? (t[tr] - x) : (t[tr] - x + t[tr] - s[srl]));
        }
        Cout(ans);
    }
}





Measured memory_bytes: 2944