func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   long long dp[200100][2];   long long ans[200100];   int main(int argc, char const *argv[]) {     int T, k;     cin >> T >> k;     dp[k][1] = 1;     dp[1][0] = 1;     for (int i = 2; i <= 100000; i++) {       if (i - k <= 0) {         dp[i][0] += dp[i - 1][0] + dp[i - 1][1];         dp[i][0] %= mod;       } else {         dp[i][0] += dp[i - 1][0] + dp[i - 1][1];         dp[i][0] %= mod;         dp[i][1] += dp[i - k][0] + dp[i - k][1];         dp[i][1] %= mod;       }     }     int a, b;     for (int i = 1; i <= 100000; i++) {       ans[i] = ans[i - 1] + dp[i][1] + dp[i][0];       ans[i] %= mod;     }     while (T--) {       scanf( %d%d , &a, &b);       cout << (mod + ans[b] - ans[a - 1]) % mod << endl;     }     return 0;   }   