#include <iostream>
#include <cstdio>
using namespace std;
typedef long long LL;
const int mod = 1000000007;
const int maxn = 2000010;
LL dp[maxn][3];
int n,m,k;
LL solve(int u,int v){
dp[0][0] = 0;
dp[0][1] = 1;
dp[0][2] = 0;
for(int i = 1; i <= n; ++i){
LL sum = (dp[i-1][0] + dp[i-1][1] + dp[i-1][2])%mod;
dp[i][2] = sum;
if(i <= u) dp[i][0] = sum;
if(i == u + 1) dp[i][0] = (sum - 1 + mod)%mod;
if(i > u + 1) dp[i][0] = (sum - dp[i - u - 1][1] - dp[i - u - 1][2] + mod)%mod;
if(i <= v) dp[i][1] = sum;
if(i == v + 1) dp[i][1] = (sum - 1 + mod)%mod;
if(i > v + 1) dp[i][1] = (sum - dp[i - v - 1][0] - dp[i - v - 1][2] + mod)%mod;
}
return (dp[n][0] + dp[n][1] + dp[n][2])%mod;
}
int main(){
while(~scanf("%d%d%d",&n,&m,&k))
printf("%lld\n",((solve(n,k) - solve(m-1,k))%mod + mod)%mod);
return 0;
}