#include #include #include using namespace std; typedef long long ll; #define M 1000000007 ll t,a,b,c,d,e,ans; ll dp[505][20005]; int main(void){ cin>>t>>a>>b>>c>>d>>e; dp[0][10000]=1; for(int i=0;i0){ dp[i+1][j+a]=(dp[i+1][j+a]+dp[i][j])%M; dp[i+1][j-a]=(dp[i+1][j-a]+dp[i][j])%M; dp[i+1][j+b]=(dp[i+1][j+b]+dp[i][j])%M; dp[i+1][j-b]=(dp[i+1][j-b]+dp[i][j])%M; dp[i+1][j+c]=(dp[i+1][j+c]+dp[i][j])%M; dp[i+1][j-c]=(dp[i+1][j-c]+dp[i][j])%M; } } } for(int i=d+10000;i<=e+10000;i++)ans=(ans+dp[t][i])%M; cout<