#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1 << 30;
const long long inf_longlong = 1LL << 62;
const int MOD = 1e9 + 7;
const int N = 2e5 + 5;
int L, v, l, r;
void read_input() { cin >> L >> v >> l >> r; }
void solve() { cout << L / v - r / v + (l - 1) / v << '\n'; }
void write_output() {}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int test_cases = 1;
  cin >> test_cases;
  while (test_cases--) {
    read_input(), solve(), write_output();
  }
  return 0;
}
