N, S, K = gets.split.map(&:to_i) MOD = 10 ** 9 + 7 dp = Array.new(N + 1) { Array.new(S + 1, 0) } 0.step(S, N) do |s| dp[0][s] = 1 end 1.upto(N - 1) do |i| 0.upto(S) do |s| m = N - i if s >= K * m dp[i][s] += dp[i - 1][s - K * m] end if s - m >= 0 dp[i][s] += dp[i][s - m] end dp[i][s] %= MOD end end puts dp[N - 1][S]