#include using namespace std; #include using namespace atcoder; using mint=atcoder::modint998244353; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define int long long signed main(){ int R,N;cin>>R>>N; vector A(N);for(auto&&e:A)cin>>e; int Q;cin>>Q; while(Q--){ int l,r;cin>>l>>r; if(l/R==r/R){ l%=R; r%=R; cout<