func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, m = 1e9 + 7;     cin >> n >> k;     int a[100005];     a[0] = 1;     for (int i = 1; i < 100005; ++i) {       if (i >= k) {         a[i] = (a[i - k] + a[i - 1]) % m;       } else {         a[i] = a[i - 1];       }     }     for (int i = 1; i < 100005; ++i) {       a[i] = (a[i] + a[i - 1]) % m;     }     while (n--) {       int x, y;       scanf( %d %d , &x, &y);       printf( %d n , (a[y] - a[x - 1] + m) % m);     }   }   