#ifndef ENV_AC
    #define ENV_AC
    #include <stdio.h>
    #include <stdlib.h>
    #include <assert.h>
    #include <fstream>
    #include <iostream>
    #include <sstream>
    #include <iomanip>
    #include <algorithm>
    #include <bitset>
    #include <array>
    #include <vector>
    #include <queue>
    #include <set>
    #include <cmath> // 変数名にy1が使えなくなるかも…。
    #include <map>
    #include <unordered_map>
    #include <unordered_set>
    #include <limits>
    #include <functional>
    #include <string>

    using int128_t = __int128_t;
    std::istream &operator>>(std::istream& input, int128_t& value) { // int128_tの入力。入力が64bitに収まる前提。
        int64_t tmp; input >> tmp; value = tmp;
        return input;
    }
    std::ostream &operator<<(std::ostream& output, const int128_t value) { // int128_tの出力。出力が64bitに収まる前提。
        output << (int64_t)value;
        return output;
    }

    namespace std {
        template<> class hash<int128_t>{
            public:
            size_t operator () ( const int128_t &x ) const {
                int64_t INF64 = std::numeric_limits<int64_t>::max();
                int64_t y1 = x / INF64;
                int64_t y2 = x % INF64;
                return hash<int64_t>()(y1) ^ hash<int64_t>()(y2);
            }
        };
    }

    int128_t imax(const int128_t a, const int128_t b) { return std::max(a, b); } // std::max, std::min は型が違うとエラーになるため、ラッパーを作る。
    int128_t imin(const int128_t a, const int128_t b) { return std::min(a, b); }
    int128_t iabs(const int128_t x) { return 0 <= x ? x : -x; }

    #define rep(i, begin, end) for(int64_t i = ((int64_t)begin); i <= ((int64_t)end); i++) // (int64_t)end としておくと、end = v.size() - 2 みたいな入力で、v.size()が1でも正常(end = -1になる）に挙動する。
    #define rev(i, begin, end) for(int64_t i = ((int64_t)begin); ((int64_t)end) <= i; i--)

    #define input1(begin, end, v1) v1.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i]; }
    #define input2(begin, end, v1, v2) v1.resize((end)+1); v2.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i]; } 
    #define input3(begin, end, v1, v2, v3) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i]; }
    #define input4(begin, end, v1, v2, v3, v4) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); v4.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i] >> v4[i]; } 
    #define input5(begin, end, v1, v2, v3, v4, v5) v1.resize((end)+1); v2.resize((end)+1); v3.resize((end)+1); v4.resize((end)+1); v5.resize((end)+1); for (int i = (begin); i <= (end); i++) { std::cin >> v1[i] >> v2[i] >> v3[i] >> v4[i] >> v5[i]; }  
    // input_arrayはbegin = 0のときのみ動作確認。Aの要素の型をテンプレートにして関数にしたほうが丁寧かもしれない。
    #define input_array(begin, N, M, A) A.resize((begin)+(N)); for (int i = 0; i < (begin)+(N); i++) { A[i].resize((begin)+(M)); } for (int i = begin; i < (begin)+(N); i++) { for (int j = begin; j < (begin)+(M); j++) { std::cin >> A[i][j]; }}

    std::vector<int> irange(const int begin, const int end) {
        std::vector<int> ret; for (int i = begin; i <= end; i++) { ret.push_back(i); }
        return ret;
    }

    template <typename T>
    std::vector<T> accumulate_vec(const std::vector<T>& vec, const bool reverse = false) {
        std::vector<T> ret; ret.resize(vec.size());
        if (reverse == false) {
            ret[0] = vec[0];
            for (int i = 1; i < ret.size(); i++) {
                ret[i] = ret[i-1] + vec[i];
            }
        } else {
            ret[ret.size()-1] = vec[ret.size()-1];
            for (int i = ret.size() - 2; 0 <= i; i--) {
                ret[i] = ret[i+1] + vec[i];
            }
        }
        return ret;
    }

    template <typename T>
    void printvec(const std::vector<T>& vec) {
        for (int i = 0; i < vec.size(); i++) { std::cout << vec[i] << " "; } std::cout << std::endl;
    }
#endif

// binary search result
struct BSR {
    bool found; // 条件を満たす範囲が見つかったか。falseの場合、begin,endは意味を持たない。
    int128_t begin; // [begin, end]で条件が成り立つ。
    int128_t end;
    BSR(bool found_in, int128_t begin_in, int128_t end_in) { found = found_in; begin = begin_in; end = end_in; }
};

//template<class Fn> BSR binary_search(int128_t L, int128_t R, Fn func) {
BSR binary_search(int128_t L, int128_t R, std::function<bool(int128_t)> func) {
    const bool res_L = func(L);
    const bool res_R = func(R);
    if (res_L && res_R) {
        return BSR(true, L, R);
    } else if (!res_L && !res_R) {
        return BSR(false, 0, 0);
    } else {
        int128_t lb = L;
        int128_t ub = R;
        while (lb + 1 < ub) {
            int128_t mid = (lb + ub) / 2;
            if (res_L == func(mid)) {
                lb = mid;
            } else {
                ub = mid;
            }
        }
        return res_L ? BSR(true, L, lb) : BSR(true, ub, R);
    }
}


//--code begin--

int128_t X, K, Q;
std::vector<int128_t> r, t, a;
//std::string ;
//std::vector<std::string> ;
//double ;
//std::vector<double> ;

const int128_t MAX_K = 1e5 + 10;
//const int128_t MOD = ;
//const int128_t INF = std::numeric_limits<int64_t>::max();
//using pair = std::pair<int64_t, int>;

int128_t min_val[MAX_K] = {};
int128_t max_val[MAX_K] = {};
int128_t min_board[MAX_K] = {};
int128_t max_board[MAX_K] = {};


int main(int argc, char **argv) {
    std::cin >> X;
    std::cin >> K;

    input1(1, K, r);

    std::cin >> Q;

    input2(1, Q, t, a);
    
    max_val[0] = X;
    min_val[0] = 0;

    max_board[0] = X;
    min_board[0] = 0;

    rep (i, 1, K) {
        max_board[i] = max_board[i-1];
        min_board[i] = min_board[i-1];
        if (i % 2 == 1) {
            max_val[i] = imax(0, max_val[i-1] - (r[i] - r[i-1]));
            min_val[i] = imax(0, min_val[i-1] - (r[i] - r[i-1]));
            if (min_val[i] == 0) {
                min_board[i] += (r[i] - r[i-1]) - min_val[i-1];
            }
        } else {
            max_val[i] = imin(X, max_val[i-1] + (r[i] - r[i-1]));
            min_val[i] = imin(X, min_val[i-1] + (r[i] - r[i-1]));

            if (max_val[i] == X) {
                max_board[i] -= max_val[i-1] + (r[i] - r[i-1]) - X;
            }
        }

        if (max_val[i] == min_val[i]) {
            max_board[i] = 0;
            min_board[i] = X;
        }
    }

    rep (i, 1, Q) {
        auto bsr = binary_search(0, K, [&](int128_t j){
            return r[j] <= t[i]; 
        });
        assert(bsr.found);
        int128_t pt = r[bsr.end];
        int128_t pv = -1;
        if (max_val[bsr.end] == min_val[bsr.end]) {
            pv = min_val[bsr.end];
        } else if (a[i] <= min_board[bsr.end]) {
            pv = min_val[bsr.end];
        } else if (max_board[bsr.end] <= a[i]) {
            pv = max_val[bsr.end];
        } else {
            pv = min_val[bsr.end] + a[i] - min_board[bsr.end];
            assert(pv == max_val[bsr.end] + a[i] - max_board[bsr.end]);
        }

        //std::cout << pv << " " << bsr.end << " " << min_val[bsr.end] << " " << max_val[bsr.end] << " " << a[i] << std::endl;

        if (bsr.end % 2 == 1) {
            pv += t[i] - r[bsr.end];
        } else {
            pv -= t[i] - r[bsr.end];
        }

        pv = imax(0, imin(pv, X));

        std::cout << pv << std::endl;

    }

    return 0;
}

Measured memory_bytes: 12160