#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())-1; ans+=n*(r-(l+l%R))/R; ans+=upper_bound(a.begin(),a.end(),r-(l+l%R))-a.begin(); ans=max(0LL,ans); cout<