local mod = 1000000007 local mfl = math.floor local n, s, k = io.read("*n", "*n", "*n") local lowlim = mfl(k * n * (n - 1) / 2) if s < lowlim then print(0) elseif s == lowlim then print(1) else s = s - lowlim local dp = {} for i = 1, s do dp[i] = 1 end for i = 1, n - 1 do local mul = n + 1 - i for p = s - mul, 1, -1 do local cntlim = mfl((s - p) / mul) local dpp = dp[p] for j = 1, cntlim do local v = j * mul dp[p + v] = (dp[p + v] + dpp) % mod end end do local cntlim = mfl(s / mul) for j = 1, cntlim do local v = j * mul dp[v] = (dp[v] + 1) % mod end end end print(dp[s]) end -- print(os.clock())