#include #include namespace my{ using namespace atcoder; using ml=modint998244353; auto&operator<<(std::ostream&o,const ml&x){return o<>(std::istream&i,ml&x){long long t;i>>t;x=t;return i;} void main(); void solve(); } int main(){my::main();} namespace my{ #define eb emplace_back #define all(a) (a).begin(),(a).end() #define RD(T,...) T __VA_ARGS__;li(__VA_ARGS__) #define LL(...) RD(ll,__VA_ARGS__) #define JO(a,b) a##b #define jo(a,b) JO(a,b) #define FE(v,e,...) for(au&&__VA_OPT__([)e __VA_OPT__(,__VA_ARGS__]):v) #define FO(n) for(ll jo(i,__LINE__)=n;jo(i,__LINE__)-->0;) #define FOR(i,...) for(au[i,i##O,i##E]=range(0,__VA_ARGS__);i=i##O;i-=i##E) #define I template #define J class #define au auto #define rr return using namespace std; Iconstexpr bool same=is_same_v; using is=istream;using os=ostream;using dd=long double;using str=string; using ll=long long;using ull=unsigned long long;using lll=__int128_t;using ulll=__uint128_t; os&operator<<(os&o,const ulll&x){rr(x<10?o:o<0?x:-x);} constexpr dd ee=1e-12; constexpr ll oo=3e18; constexpr ll dx[]{-1,0,1,0,-1,1,1,-1},dy[]{0,-1,0,1,-1,-1,1,1}; constexpr char sp=32,nl=10; au Yes(bool y){rr y?"Yes":"No";} au No(){rr Yes(0);} au range(bool s,ll a,ll b=oo,ll c=1){if(b==oo)b=a,(s?b:a)=0;rr tuple{a-s,b,c};} Ill len(const T&a){rr a.size();} Iau max(const A&...a){rr max(initializer_list>{a...});} Istruct cp{ A a={};B b={}; cp(){} cp(A a,B b):a(a),b(b){} cp(pairp):a(p.first),b(p.second){} bool operator==(const cp&c)const{rr a==c.a&&b==c.b;} auto operator<=>(const cp&c)const{rr a!=c.a?a<=>c.a:b<=>c.b;} friend is&operator>>(is&i,cp&c){rr i>>c.a>>c.b;} friend os&operator<<(os&o,const cp&c){rr o<; Istruct tr{ A a={};B b={};C c={}; tr(){} tr(A a,B b,C c):a(a),b(b),c(c){} bool operator==(const tr&t)const{rr a==t.a&&b==t.b&&c==t.c;} auto operator<=>(const tr&t)const{rr a!=t.a?a<=>t.a:b!=t.b?b<=>t.b:c<=>t.c;} friend is&operator>>(is&i,tr&t){rr i>>t.a>>t.b>>t.c;} friend os&operator<<(os&o,const tr&t){rr o<; Idecltype(au)first(T&a){rr*begin(a);} Iau pop_front(T&a){assert(len(a));au r=first(a);a.pop_front();rr r;} Iusing array=std::array; Ios&operator<<(os&o,const array&a){fo(i,n)o<using map=std::map; Ios&operator<<(os&o,const map&m){fe(m,e)o<using umap=unordered_map; Ios&operator<<(os&o,const umap&m){fe(m,e)o<using bset=bitset; Ios&operator<<(os&o,const bset&b){fo(i,n)o<os&operator<<(os&o,const tuple&t){apply([&](const au&...a){ll i=sizeof...(a);(((o<0,sp))),...);},t);rr o;} Istruct priority_queue:std::priority_queue,F>{ priority_queue(const initializer_list&a={}){fe(a,e)this->emplace(e);} priority_queue(const vector&a){fe(a,e)this->emplace(e);} T front(){rr this->top();} T pop_front(){T r=this->top();this->pop();rr r;} friend os&operator<<(os&o,priority_queue q){while(len(q))o<0,sp);rr o;} }; Iusing max_priority_queue=priority_queue>; Iusing min_priority_queue=priority_queue>; Istruct ve; Iconstexpr bool isv=0; Iconstexpr bool isv> =1; Iconstexpr bool isv> =1; Iau rawv(V){if constexpr(isv)rr rawv(V(1)[0]);else rr V();} Istruct ve:vector{ using vector::vector; using T=decltype(rawv(V())); Ive(const vector&v={}){static_assert(isv ==isv);fe(v,e)this->eb(e);} ve&operator+=(const ve&u){au&v=*this;fo(i,len(v))v[i]+=u[i];rr v;}ve operator+(const ve&u)const{rr ve(*this)+=u;} ve&operator-=(const ve&u){au&v=*this;fo(i,len(v))v[i]-=u[i];rr v;}ve operator-(const ve&u)const{rr ve(*this)-=u;} ve&operator^=(const ve&u){fe(u,e)this->eb(e);rr*this;}ve operator^(const ve&u)const{rr ve(*this)^=u;} ve&operator+=(const T&x){au&v=*this;fe(v,e)e+=x;rr v;}ve operator+(const T&x)const{rr ve(*this)+=x;} ve&operator-=(const T&x){au&v=*this;fe(v,e)e-=x;rr v;}ve operator-(const T&x)const{rr ve(*this)-=x;} ve&operator*=(const T&x){au&v=*this;fe(v,e)e*=x;rr v;}ve operator*(const T&x)const{rr ve(*this)*=x;} ve&operator++(){rr*this+=1;} ve&operator--(){rr*this-=1;} ve operator-()const{rr ve(*this)*=-1;} Iau&operator+=(const bset&a){fo(i,n)(*this)[i]+=a[i];rr*this;} Iau&operator-=(const bset&a){fo(i,n)(*this)[i]-=a[i];rr*this;} au lower_bound(const V&x)const{rr std::lower_bound(all(*this),x);} au upper_bound(const V&x)const{rr std::upper_bound(all(*this),x);} Iau scan(F f)const{cpr;fe(*this,e)if constexpr(!isv)r.b?f(r.a,e),r:r={e,1};else if(au s=e.scan(f);s.b)r.b?f(r.a,s.a),r:r=s;rr r;} T max()const{rr scan([](T&a,const T&b){a>(is&i,ve&v){fe(v,e)i>>e;rr i;} friend os&operator<<(os&o,const ve&v){fe(v,e)o<?nl:sp);rr o;} }; Iau vec(const ll(&s)[n],T x={}){if constexpr(n==i+1)rr ve(s[i],x);else{au X=vec(s,x);rr ve(s[i],X);}} Ivoid set_size(const ll(&l)[n],A&...a){((a=vec(l,rawv(a))),...);} Iusing v2=ve>;using u1=ve;using u2=v2; using graph=v2; void io(){cin.tie(0)->sync_with_stdio(0);cout<void li(A&...a){(cin>>...>>a);} Ivoid pp(const A&...a){ll i=sizeof...(a);((cout<0,c)),...);cout<struct rec:F{rec(F&&f):F(std::forward(f)){}Idecltype(au)operator()(A&&...a)const{rr F::operator()(*this,std::forward(a)...);}}; void main(){io();ll T=1;fo(T)solve();} void solve(){ LL(L,R,A,B,C); ll C1=max(0,C-A-B); ll D=R+1-(L+A+B+C1); pp(ml(D)*(D+1)*(2+C1+D)/6); }}