ll T,a[6],d,e; mint D[501][20041],z; { rd(T,a(3),d,e); a[3..5]=-a[0..]; D[0][10020]=1; rep(i,T){ rep(j,20,20021){ rep(k,6){ D[i+1][j+a[k]]+=D[i][j]; } } } z+=D[T][10020+(d..e)]; wt(z); }