#include <bits/stdc++.h>
#define int long long
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a+MOD)%MOD)+((b+MOD)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define MOD 1000000007
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using VPII = vector<PII>;
template<typename T, typename C>
using PQ = priority_queue<T, vector<T>, C>;
using Complex = complex<double>;


int A, B, Q;
int s[100010];
int t[100010];


signed main(){
    cin >> A >> B >> Q;
    rep(i, 0, A) cin >> s[i];
    rep(i, 0, B) cin >> t[i];

    int x;
    rep(i, 0, Q){
        cin >> x;
        int s1 = distance(&s[0], ub(RNG(s, 0, A), x));
        int t1 = distance(&t[0], ub(RNG(t, 0, B), x));
        int ans = INF;
        if(s1 == 0 && t1 == 0) chmin(ans, max(s[s1], t[t1])-x);
        else if(s1 == 0 && t1 == B){
            int t2 = t1-1;
            chmin(ans, s[s1]-x+s[s1]-t[t2]);
            chmin(ans, x-t[t2]+s[s1]-t[t2]);
        }
        else if(s1 == A && t1 == 0){
            int s2 = s1-1;
            chmin(ans, t[t1]-x+t[t1]-s[s2]);
            chmin(ans, x-s[s2]+t[t1]-s[s2]);
        }
        else if(s1 == 0){
            chmin(ans, max(s[s1], t[t1])-x);
            chmin(ans, s[s1]-x+s[s1]-t[t1-1]);
            chmin(ans, x-t[t1-1]+s[s1]-t[t1-1]);
        }
        else if(t1 == 0){
            chmin(ans, max(s[s1], t[t1])-x);
            chmin(ans, t[t1]-x+t[t1]-s[s1-1]);
            chmin(ans, x-s[s1-1]+t[t1]-s[s1-1]);
        }
        else {
            int s2 = s1-1;
            int t2 = t1-1;
            if(s1 == A && t1 == B) chmin(ans, x-min(s[s2], t[t2]));
            else if(s1 == A){
                chmin(ans, x-min(s[s2], t[t2]));
                chmin(ans, t[t1]-x+t[t1]-s[s2]);
                chmin(ans, x-s[s2]+t[t1]-s[s2]);
            }
            else if(t1 == B){
                chmin(ans, x-min(s[s2], t[t2]));
                chmin(ans, s[s1]-x+s[s1]-t[t2]);
                chmin(ans, x-t[t2]+s[s1]-t[t2]);
            }
            else {
                chmin(ans, max(s[s1], t[t1])-x);                
                chmin(ans, x-min(s[s2], t[t2]));
                chmin(ans, s[s1]-x+s[s1]-t[t2]);
                chmin(ans, x-t[t2]+s[s1]-t[t2]);
                chmin(ans, t[t1]-x+t[t1]-s[s2]);
                chmin(ans, x-s[s2]+t[t1]-s[s2]);
            }
        }
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 2816