#include <bits/stdc++.h>
typedef long long LL;
using namespace std;
const int N = 1e5 + 5;
const LL INF = 0x3f3f3f3f3f3f3f3fLL;
struct poi {
    int siz, ls, rs;
    int rnd, id;
    LL v;
};
struct tree {
    poi tr[N];
    int tot = 0, rt = 0;
    inline void newnode(int &k, LL v, int id) {
        k = ++tot;
        tr[tot].siz = 1;
        tr[tot].ls = tr[tot].rs = 0;
        tr[tot].rnd = rand();
        tr[tot].v = v;
        tr[tot].id = id;
    }
    inline void update(int k) {
        tr[k].siz = tr[tr[k].ls].siz + tr[tr[k].rs].siz + 1;
    }
    inline void split(int k, int &nls, int &nrs, LL v) {
        if (!k) {
            nls = nrs = 0;
            return ;
        }
        if (tr[k].v <= v) {
            nls = k;
            split(tr[k].rs, tr[nls].rs, nrs, v);
        }
        else {
            nrs = k;
            split(tr[k].ls, nls, tr[nrs].ls, v);
        }
        update(k);
    }
    inline void merge(int &k, int a, int b) {
        if ((!a) || (!b)) {
            k = a + b;
            return ;
        }
        if (tr[a].rnd < tr[b].rnd) {
            k = a;
            merge(tr[k].rs, tr[a].rs, b);
        }
        else {
            k = b;
            merge(tr[k].ls, a, tr[b].ls);
        }
        update(k);
    }
    inline void ins(LL v, int id) {
        int x = 0, y = 0, z = 0;
        split(rt, x, y, v);
        newnode(z, v, id);
        merge(x, x, z);
        merge(rt, x, y);
    }
    inline int atrnk(int cur, int c) {
        if (!cur) return -1;
        if (tr[ tr[cur].ls ].siz >= c) return atrnk(tr[cur].ls, c);
        else if (tr[ tr[cur].ls ].siz + 1 == c) return tr[cur].id;
        else return atrnk(tr[cur].rs, c - (tr[ tr[cur].ls ].siz + 1 ));
    }
    inline int pre(LL v) {
        int x = 0, y = 0, z = 0;
        split(rt, x, y, v);
        int res = atrnk(x, tr[x].siz);
        merge(rt, x, y);
        return res;
    }
    inline int suf(LL v) {
        int x = 0, y = 0, z = 0;
        split(rt, x, y, v);
        int res = atrnk(y, 1);
        merge(rt, x, y);
        return res;
    }
}T1, T2;
int n, m, q;
LL aa[N], bb[N];
int main() {
    scanf("%d %d", &n, &m);
    scanf("%d", &q);
    for (int i = 1; i <= n; ++i) {
        LL t;
        scanf("%lld", &t);
        aa[i] = t;
        T1.ins(t, i);
    }
    for (int i = 1; i <= m; ++i) {
        LL t;
        scanf("%lld", &t);
        bb[i] = t;
        T2.ins(t, i);
    }
    for (int i = 1; i <= q; ++i) {
        LL res = 0, x;
        scanf("%lld", &x);
        int d1 = T1.pre(x), d2 = T1.suf(x), d3 = T2.pre(x), d4 = T2.suf(x);
        LL ans = INF;
        if (d1 != -1 && d3 != -1) {
            ans = min(ans, x - min(aa[d1], bb[d3]));
        }
        if (d2 != -1 && d4 != -1) {
            ans = min(ans, max(aa[d2], bb[d4]) - x);
        }
        if (d1 != -1 && d4 != -1)ans = min(ans, 2 * (x - aa[d1]) + (bb[d4] - x));
        if (d1 != -1 && d4 != -1)ans = min(ans, (x - aa[d1]) + 2 * (bb[d4] - x));
        if (d3 != -1 && d2 != -1)ans = min(ans, (x - bb[d3]) + 2 * (aa[d2] - x));
        if (d3 != -1 && d2 != -1)ans = min(ans, 2 * (x - bb[d3]) + (aa[d2] - x));
        printf("%lld\n", ans);
    }
    return 0;
}


Measured memory_bytes: 9088