#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int mod = 100003;
const int maxn = 2e5 + 100;
const int maxm = 2e5 + 100;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
int main() {
  int t;
  int L, v, l, r;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d %d %d", &L, &v, &l, &r);
    int ans = L / v;
    int tmp = r / v - (l - 1) / v;
    ans -= tmp;
    printf("%d\n", ans);
  }
  return 0;
}
