#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i(0); i < t; i++) {
    int L, v, l, r;
    cin >> L >> v >> l >> r;
    int cnt = L / v;
    int tr = r / v;
    int tr2 = (l - 1) / v;
    cout << cnt - (tr - tr2) << endl;
  }
  return 0;
}
