#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+R-l%R)); ll n1=rest/R; ll n2=rest%R; ans+=n*n1; ans+=upper_bound(a.begin(),a.end(),n2)-a.begin(); cout<