#include #include using namespace std; using mint = atcoder::modint1000000007; int main(){ int T, d, e, D = 0; vector a(3); cin >> T >> a[0] >> a[1] >> a[2] >> d >> e; for(auto v:a) D = max(D, abs(v)); vector dp1(20001), dp2(20001); auto dp = dp1.begin() + 10000, ndp = dp2.begin() + 10000; dp[0] = 1; for(int i = 0; i < T; i++){ for(int j = -i * D; j <= i * D; j++){ for(auto &&v : a){ ndp[j - v] += dp[j]; ndp[j + v] += dp[j]; } dp[j] = 0; } swap(dp, ndp); } cout << accumulate(dp + d, dp + e + 1, mint(0)).val() << '\n'; }