#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
const int K = 200;
const int nbl = maxn / K + 5;
int X;
int n;
int a[maxn];
int id[maxn];
int t[maxn];
int res[maxn];
pair<int, int> M[maxn];
vector<int> times;
int T = 0;
size_t pos = 0;
void scan() {
  cin >> X;
  int k;
  cin >> k;
  times.resize(k);
  for (int i = 0; i < (int)(k); ++i) {
    cin >> times[i];
  }
  cin >> n;
  vector<tuple<int, int, int>> in(n);
  for (int i = 0; i < (int)(n); ++i) {
    int x, y;
    cin >> x >> y;
    in[i] = make_tuple(y, x, i);
  }
  sort((in).begin(), (in).end());
  for (int i = 0; i < (int)(n); ++i) {
    tie(a[i], t[i], id[i]) = in[i];
  }
}
void update(int b) {
  if (M[b] == pair<int, int>(1, 0)) return;
  int L = b * K;
  int R = min(L + K, n);
  for (int i = (int)(L); i < (int)(R); ++i) {
    a[i] = a[i] * M[b].first + M[b].second;
  }
  M[b] = {1, 0};
}
pair<int, int> minmax(int b) {
  int L = b * K;
  int R = min(L + K, n);
  return pair<int, int>(a[R] * M[b].first + M[b].second,
                        a[R - 1] * M[b].first + M[b].second);
}
int cc(int x) { return min(X, max(x, 0)); }
void answer(int i) {
  update(i / K);
  int x = a[i];
  if (pos % 2 == 0) {
    x -= t[i] - times[pos];
  } else {
    x += t[i] - times[pos];
  }
  res[id[i]] = cc(x);
}
void addb(int x, int b) {
  update(b);
  int L = b * K;
  int R = min(L + K, n);
  for (int i = (int)(L); i < (int)(R); ++i) {
    if (pos % 2 == 0)
      a[i] = cc(a[i] - x);
    else
      a[i] = cc(a[i] + x);
  }
}
void add(int x) {
  x = min(x, X);
  if (pos % 2 == 0) {
    for (int i = 0; i < (int)((n - 1) / K + 1); ++i) {
      int l, r;
      tie(l, r) = minmax(i);
      if (r <= x)
        M[i] = {0, 0};
      else if (l >= x)
        M[i] = {M[i].first, M[i].second - x};
      else
        addb(x, i);
    }
  } else {
    for (int i = 0; i < (int)((n - 1) / K + 1); ++i) {
      int l, r;
      tie(l, r) = minmax(i);
      if (r <= X - x)
        M[i] = {M[i].first, M[i].second + x};
      else if (l >= X - x)
        M[i] = {0, X};
      else
        addb(x, i);
    }
  }
}
void solve() {
  for (int i = 0; i < (int)(maxn); ++i) M[i] = {1, 0};
  vector<pair<int, int>> byt(n);
  for (int i = 0; i < (int)(n); ++i) byt[i] = {t[i], i};
  sort((byt).begin(), (byt).end());
  int pt = 0;
  times.insert(times.begin(), 0);
  while (pos < times.size() - 1) {
    int nt = times[pos + 1];
    while (pt < n && byt[pt].first <= nt) {
      answer(byt[pt++].second);
    }
    T = nt;
    add(times[pos + 1] - times[pos]);
    ++pos;
  }
  while (pt < n) {
    answer(byt[pt++].second);
  }
  for (int i = 0; i < (int)(n); ++i) {
    cout << res[i] << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  scan();
  solve();
  return 0;
}
