#include using namespace std; #define ALL(x) begin(x),end(x) #define rep(i,n) for(int i=0;i<(n);i++) #define debug(v) cout<<#v<<":";for(auto x:v){cout<bool chmax(T &a,const T &b){if(abool chmin(T &a,const T &b){if(b ostream &operator<<(ostream &os,const vector&v){ for(int i=0;i<(int)v.size();i++) os< istream &operator>>(istream &is,vector&v){ for(T &x:v)is>>x; return is; } template struct ModInt{ long long x; ModInt():x(0){} ModInt(long long y):x(y>=0?y%Mod:(Mod-(-y)%Mod)%Mod){} ModInt &operator+=(const ModInt &p){ if((x+=p.x)>=Mod) x-=Mod; return *this; } ModInt &operator-=(const ModInt &p){ if((x+=Mod-p.x)>=Mod)x-=Mod; return *this; } ModInt &operator*=(const ModInt &p){ x=(int)(1ll*x*p.x%Mod); return *this; } ModInt &operator/=(const ModInt &p){ (*this)*=p.inverse(); return *this; } ModInt operator-()const{return ModInt(-x);} ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;} ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;} ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;} ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;} bool operator==(const ModInt &p)const{return x==p.x;} bool operator!=(const ModInt &p)const{return x!=p.x;} ModInt inverse()const{ int a=x,b=Mod,u=1,v=0,t; while(b>0){ t=a/b; swap(a-=t*b,b);swap(u-=t*v,v); } return ModInt(u); } ModInt pow(long long n)const{ ModInt ret(1),mul(x); while(n>0){ if(n&1) ret*=mul; mul*=mul;n>>=1; } return ret; } friend ostream &operator<<(ostream &os,const ModInt &p){return os<>(istream &is,ModInt &a){long long t;is>>t;a=ModInt(t);return (is);} static int get_mod(){return Mod;} }; using mint=ModInt<1000000007>; template struct FormalPowerSeriesNaive:vector{ using vector::vector; using P=FormalPowerSeriesNaive; P multiply(const P &lhs,const P &rhs){ auto ret=P((int)lhs.size()+rhs.size()-1); for(int i=0;i<(int)lhs.size();i++)for(int j=0;j<(int)rhs.size();j++) ret[i+j]+=lhs[i]*rhs[j]; return ret; } void shrink(){while(this->size() and this->back()==T(0)) this->pop_back();} P pre(int sz)const{return P(begin(*this),begin(*this)+min((int)this->size(),sz));} P operator+(const P &rhs)const{return P(*this)+=rhs;} P operator+(const T &rhs)const{return P(*this)+=rhs;} P operator-(const P &rhs)const{return P(*this)-=rhs;} P operator-(const T &rhs)const{return P(*this)-=rhs;} P operator*(const P &rhs)const{return P(*this)*=rhs;} P operator*(const T &rhs)const{return P(*this)*=rhs;} P operator/(const P &rhs)const{return P(*this)/=rhs;} P operator%(const P &rhs)const{return P(*this)%=rhs;} P &operator+=(const P &rhs){ if(rhs.size()>this->size()) this->resize(rhs.size()); for(int i=0;i<(int)rhs.size();i++) (*this)[i]+=rhs[i]; return (*this); } P &operator+=(const T &rhs){ if(this->empty()) this->resize(1); (*this)[0]+=rhs; return (*this); } P &operator-=(const P &rhs){ if(rhs.size()>this->size()) this->resize(rhs.size()); for(int i=0;i<(int)rhs.size();i++) (*this)[i]-=rhs[i]; shrink(); return (*this); } P &operator-=(const T &rhs){ if(this->empty()) this->resize(1); (*this)[0]-=rhs; shrink(); return (*this); } P &operator*=(const T &rhs){ const int n=(int)this->size(); for(int i=0;iempty() or rhs.empty()){ this->clear(); return (*this); } auto ret=multiply(*this,rhs); (*this)=ret; return (*this); } P &operator%=(const P &rhs){return (*this)-=(*this)/rhs*rhs;} P operator-()const{ P ret(this->size()); for(int i=0;i<(int)this->size();i++) ret[i]=-(*this)[i]; return ret; } P &operator/=(const P &rhs){ if(this->size()clear(); return (*this); } int n=(int)this->size()-rhs.size()+1; return (*this)=(rev().pre(n)*rhs.rev().inv(n)); } P operator>>(int sz)const{ if((int)this->size()<=sz) return {}; P ret(*this); ret.erase(ret.begin(),ret.begin()+sz); return ret; } P operator<<(int sz)const{ P ret(*this); ret.insert(ret.begin(),sz,T(0)); return ret; } P rev(int deg=-1)const{ P ret(*this); if(deg!=-1) ret.resize(deg,T(0)); reverse(begin(ret),end(ret)); return ret; } // ref : https://qiita.com/hotman78/items/f0e6d2265badd84d429a P inv(int deg=-1)const{ assert(((*this)[0])!=T(0)); const int n=(int)this->size(); if(deg==-1) deg=n; P ret({T(1)/(*this)[0]}); for(int i=1;i>=1; if((int)ret.size()>deg) ret.resize(deg); if((int)b.size()>deg) b.resize(deg); } return ret; } // [l,r) k個飛び P slice(int l,int r,int k=1){ P ret; for(int i=l;i d次元,multiplyの計算量) return : [x^k] (*this) / q */ T nth_term(P q,ll k){ if(k==0) return (*this)[0]/q[0]; P p(*this); P q_=q; for(int i=1;i<(int)q_.size();i+=2) q_[i]*=-1; q*=q_;p*=q_;// qは奇数項が消える return p.slice(k%2,p.size(),2).nth_term(q.slice(0,q.size(),2),k/2); } }; using FPS=FormalPowerSeriesNaive; signed main(){ int n,s,k;cin>>n>>s>>k; s-=n*(n-1)/2*k; if(s<0){ cout<<0<