#include <bits/stdc++.h>
int main() {
  int t, n, L, v, l, r;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d%d", &L, &v, &l, &r);
    n = 0;
    n = L / v - r / v + (l - 1) / v;
    printf("%d\n", n);
  }
  return 0;
}
