#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int L, v, l, r;
    cin >> L >> v >> l >> r;
    int cnt = 0;
    int a1 = (l - 1) / v;
    int a2 = r / v;
    int left = a2 - a1;
    int f = L / v;
    cnt = f - left;
    cout << cnt << endl;
  }
  return 0;
}
