#include #include #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define PI arccos(-1) #define all(v) (v).begin(),(v).end() #define fi first #define se second #define mpa make_pair #define emb emplace_back #define endll "\n" using namespace std; using namespace atcoder; using ll = long long; template constexpr inline void input(vector &v){ for(int i=0;i> v[i]; } template constexpr inline void input(vector &v,vector &u){ for(int i=0;i> v[i] >> u[i]; } template constexpr inline void input(vector &v,vector &u,vector &t){ for(int i=0;i> v[i] >> u[i] >> t[i]; } template constexpr inline void input(vector> &v){ for(int i=0;i> v[i][j]; } } template constexpr inline void output(vector &v,bool space = true){ if(space){ for(int i=0;i constexpr inline void output(vector &v,vector &u){ for(int i=0;i constexpr inline void output(vector &v,vector &u,vector &t){ for(int i=0;i constexpr inline void output(vector> &v){ for(int i=0;i constexpr inline bool on(T n,T i){ return n&(1< constexpr inline T ceil(T x,S y){ if(x == 0) return 0; else return (x-1)/y+1; } template constexpr bool isprime(T x){ for(T i=2;i*i<=x;i++){ if(x%i == 0) return false; } return true; } vector isprime_format(int n){ vector P(n+1,1);P[0] = P[1] = 1; for(int i=2;i*i<=n;i++){ if(!P[i]) continue; for(int j=i+i;j<=n;j+=i) P[j] = false; } return P; } vector prime_format(int n){ vector P = isprime_format(n); vector ans; for(int i=2;i<=n;i++){ if(P[i]) ans.emb(i); } return ans; } template vector topo_sort(T N,vector> G){ T i,j,f; vector cnt(N); for(i=0;i q; for(i=0;i vector dijkstra(T N,vector st,vector>> G){ T fn,fp,i; priority_queue,vector>,greater<>> q; vector D(N,-1); for(i=0;i D[fp]+G[fp][i].se){ D[G[fp][i].fi] = D[fp]+G[fp][i].se; q.push(mpa(D[G[fp][i].fi],G[fp][i].fi)); } } } return D; } template vector dijkstra(T N,T st,vector>> G){ return dijkstra(N,vector({st}),G); } template class WarshallFloyd{ T N,inf; vector> D; vector> prev; bool isdirect; void setting(){ for(T k=0;k D[i][k]+D[k][j]){ D[i][j] > D[i][k]+D[k][j]; prev[i][j] = prev[k][j]; } } } } } public: WarshallFloyd(T N,vector &u,vector &v,vector &c,T inf,bool isdirect){ this->N = N; this->inf = inf; this->isdirect = isdirect; assert(u.size() == v.size()); vector>(N,vector(N,inf)).swap(D); vector>(N,vector(N)).swap(prev); for(T i=0;i> D,T inf,bool isdirect){ this->N = D.size(); this->inf = inf; this->D = D; this->isdirect = isdirect; vector>(N,vector(N)).swap(prev); for(T i=0;i D[i][s]+c+D[t][j]){ D[i][j] = D[i][s]+c+D[t][j]; prev[i][j] = prev[t][j]; } } if(!isdirect && D[i][t] != inf && D[s][j] != inf){ if(D[i][j] > D[i][t]+c+D[s][j]){ D[i][j] = D[i][t]+c+D[s][j]; prev[i][j] = prev[s][j]; } } } } } T at(T i,T j){ return D[i][j]; } vector Path(T s,T t){ vector ret; ret.emb(t); while(t != s) ret.emb(t=prev[s][t]); reverse(all(ret)); return ret; } bool negative_cycle(){ for(T i=0;i> Graph(){ return D; } }; template class mat{ vector> V; public: constexpr mat(){} constexpr mat(int N,int M){ vector>(N,vector(M)).swap(this->V); } constexpr mat(vector> &v){ this->V = v; } constexpr int height(){return V.size();} constexpr int width(){return V[0].size();} constexpr T &val(int a,int b){return V[a][b];} constexpr vector val(int a){return V[a];} constexpr vector> val(){return V;} //ret(mat[i][j],elem(a[i][k],b[k][j])) constexpr mat calc(mat &b,function ret = [](T x,T y){return x+y;},function elem = [](T x,T y){return x*y;})const{ vector> c(V.size(),vector(b.width())); for(int i=0;i ret = [](T x,T y){return x+y;},function elem = [](T x,T y){return x*y;}) const { mat x = *this,z; while(y){ if(y&1){ if(z.height() == 0) z = x; else z = z.calc(x,ret,elem); } x = x.calc(x,ret,elem); y >>= 1; } return z; } }; template class frac{ T bunsi,bunbo; constexpr void setting() noexcept { T g = gcd(bunsi,bunbo); bunsi /= g;bunbo /= g; if(bunbo < 0){ bunsi = -bunsi;bunbo = -bunbo; } } public: constexpr frac(T Bunsi = 0,T Bunbo = 1) noexcept { bunsi = Bunsi;bunbo = Bunbo; setting(); } constexpr T &Bunsi() noexcept {return bunsi;} constexpr const T &Bunsi() const noexcept {return bunsi;} constexpr T &Bunbo() noexcept {return bunbo;} constexpr const T &Bunbo() const noexcept {return bunbo;} constexpr frac &operator+=(const frac &rhs) noexcept { bunsi = bunsi*rhs.bunbo+bunbo*rhs.bunsi; bunbo *= rhs.bunbo; setting(); return *this; } constexpr frac &operator-=(const frac &rhs) noexcept { bunsi = bunsi*rhs.bunbo-bunbo*rhs.bunsi; bunbo *= rhs.bunbo; setting(); return *this; } constexpr frac &operator*=(const frac &rhs) noexcept { bunbo *= rhs.bunbo; bunsi *= rhs.bunsi; setting(); return *this; } constexpr frac &operator/=(const frac &rhs) noexcept { bunbo *= rhs.bunsi; bunsi *= rhs.bunbo; setting(); return *this; } constexpr frac operator+(const frac &rhs) const noexcept {return frac(*this) += rhs;} constexpr frac operator-(const frac &rhs) const noexcept {return frac(*this) -= rhs;} constexpr frac operator*(const frac &rhs) const noexcept {return frac(*this) *= rhs;} constexpr frac operator/(const frac &rhs) const noexcept {return frac(*this) /= rhs;} constexpr bool operator<(const frac &rhs) const noexcept {return bunsi*rhs.bunbo < bunbo*rhs.bunsi;} constexpr bool operator>(const frac &rhs) const noexcept {return bunsi*rhs.bunbo > bunbo*rhs.bunsi;} constexpr bool operator>=(const frac &rhs) const noexcept {return bunsi*rhs.bunbo >= bunbo*rhs.bunsi;} constexpr bool operator<=(const frac &rhs) const noexcept {return bunsi*rhs.bunbo <= bunbo*rhs.bunsi;} constexpr bool operator==(const frac &rhs) const noexcept {return bunsi*rhs.bunbo == bunbo*rhs.bunsi;} constexpr bool operator!=(const frac &rhs) const noexcept {return bunsi*rhs.bunbo != bunbo*rhs.bunsi;} }; template class line{ //y = ax+b; frac a,b; bool a_inf; T inf_x; public: constexpr line(T x1 = 0,T y1 = 0,T x2 = 1,T y2 = 1) noexcept { if(x1 != x2){ a_inf = false; a = frac(y2-y1,x2-x1); b = frac(y1)-frac(x1)*a; } else{ a_inf = true; inf_x = x1; } } constexpr frac &slope() noexcept {return a;} constexpr const frac &slope() const noexcept {return a;} constexpr frac &inter() noexcept {return b;} constexpr const frac &inter() const noexcept {return b;} constexpr bool match(const line &rhs) const noexcept { if(!a_inf && !rhs.a_inf) return a==rhs.a && b==rhs.b; else if(a_inf^rhs.a_inf) return false; else return inf_x==rhs.inf_x; } constexpr bool parallel(const line &rhs) const noexcept { if(!a_inf && !rhs.a_inf) return a==rhs.a; else return !(a_inf^rhs.a_inf); } constexpr pair,frac> point(const line &rhs) const noexcept { //ax+b = y //cx+d = y //(a-c)x= d-b if(a_inf){ frac x(inf_x); frac y = rhs.a*x+rhs.b; return make_pair(x,y); } else if(rhs.a_inf){ frac x(rhs.inf_x); frac y = a*x+b; return make_pair(x,y); } else{ frac x = (rhs.b-b)/(a-rhs.a); frac y = a*x+b; return make_pair(x,y); } } }; int main(){ cin.tie(0);ios::sync_with_stdio(false); //----------------------------------------------- ll N,M,X,Y,Z,a,i,j,k,l,alx = 0;cin >> N >> M >> X >> Y >> Z; vector> dp(M+1,vector(M*50+1)),ndp;dp[0][0] = 1; for(i=0;i> a; if(X <= a) alx++; vector>(M+1,vector(M*50+1)).swap(ndp); for(j=0;j<=M;j++){ for(k=0;k<=M*50;k++){ if(a < X) ndp[j][k] += dp[j][k]; if(a > Y && j M){ cout << "Handicapped" << endll;return 0; } else{ ll sum = 0; for(j=1;j<=M;j++) sum += dp[j][j*Z]; cout << sum << endll; } }