#include <bits/stdc++.h>
using LL = long long;
using D = double;
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  ;
  while (t--) {
    int L, v, l, r;
    cin >> L >> v >> l >> r;
    cout << (L / v) - (r / v - (l - 1) / v) << '\n';
  }
}
