#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(ll i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll,ll> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a), t(b);
    rep (i, a) cin >> s[i];
    rep (i, b) cin >> t[i];
    rep (i, q) {
        ll x;
        cin >> x;
        int left_s = -1, right_s = a;
        while (right_s - left_s > 1) {
            int med = (right_s + left_s) / 2;
            if (s[med] < x) left_s = med;
            else right_s = med;
        }
        int left_t = -1, right_t = b;
        while (right_t - left_t > 1) {
            int med = (right_t + left_t) / 2;
            if (t[med] < x) left_t = med;
            else right_t = med;
        }
        eprintf("%lld s[%d]=%lld,s[%d]=%lld t[%d]=%lld,t[%d]=%lld %d %d\n", x, left_s, s[left_s], right_s, s[right_s], left_t, t[left_t], right_t, t[right_t],
            (x < s[0] ? -1 : (x > s.back() ? 1 : 0)), (x < t[0] ? -1 : (x > t.back() ? 1 : 0)));
        if (x < s[0]) {
            if (x < t[0]) cout << max(t[0], s[0]) - x << "\n";
            else if (x > t.back()) cout << s[0] - t.back() + min(s[0] - x, x - t.back()) << "\n";
            else cout << min(max(t[right_t], s[0]) - x, s[0] - t[left_t] + min(s[0] - x, x - t[left_t])) << "\n";
        } else if (x > s.back()) {
            if (x < t[0]) cout << t[0] - s.back() + min(t[0] - x, x - s.back()) << "\n";
            else if (x > t.back()) cout << x - min(t.back(), s.back()) << "\n";
            else cout << min(t[right_t] - s.back() + min(t[right_t] - x, x - s.back()), x - min(t[left_t], s.back())) << "\n";
        } else {
            if (x < t[0]) {
                cout << min(t[0] - s[left_s] + min(t[0] - x, x - s[left_s]), max(t[0], s[right_s]) - x) << "\n";
            } else if (x > t.back()) {
                cout << min(s[right_s] - t.back() + min(s[right_s] - x, x - t.back()), x - min(s[left_s], t.back())) << "\n";
            } else {
                cout << min(min(max(s[right_s], t[right_t]) - x, x - min(s[left_s], t[left_t])),
                        min(t[right_t] - s[left_s] + min(t[right_t] - x, x - s[left_s]), 
                        s[right_s] - t[left_t] + min(s[right_s] - x, x - t[left_t]))) << "\n";
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2944