func_code_string: #include <bits/stdc++.h>   using namespace std;   long long modpow(long long base, long long exp, long long modulus) {     base %= modulus;     long long result = 1;     while (exp > 0) {       if (exp & 1) result = (result * base) % modulus;       base = (base * base) % modulus;       exp >>= 1;     }     return result;   }   int main() {     long long n, k;     cin >> n >> k;     long long w[100001];     long long q[100001];     memset(q, 0, sizeof(q));     memset(w, 0, sizeof(w));     w[0] = 1;     if (1 >= k)       w[1] = 2;     else       w[1] = 1;     q[0] = 0;     q[1] += q[0] + w[1];     for (long long i = 2; i < 100001; i++) {       if (k <= i) {         w[i] += (w[i - 1] + w[i - k] - 1000000007) % 1000000007;       } else         w[i] = 1;       q[i] += (q[i - 1] + w[i] - 1000000007) % 1000000007;       q[i] %= 1000000007;     }     while (n--) {       long long a, b;       cin >> a >> b;       cout << (q[b] - q[a - 1] + 1000000007) % 1000000007 <<   n ;     }     return 0;   }   