#include using namespace std; using ll=long long; int main(){ ll R,n; cin>>R>>n; vector a(n); for(ll i=0;i>a[i]; } sort(a.begin(),a.end()); ll q; cin>>q; while(q--){ ll l,r; cin>>l>>r; ll ans=0; ans+=n-(lower_bound(a.begin(),a.end(),l%R)-a.begin()); ll rest=(r-l+1)-(R-l%R)+1; ll n1=rest/R; ans+=n1*n; ll n2=rest%R; ans+=upper_bound(a.begin(),a.end(),n2)-a.begin(); ans--; cout<