#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() template bool chmax(T& x, const T& y){return (x bool chmin(T& x, const T& y){return (x>y)?(x=y,true):false;}; constexpr ll MOD=998244353; constexpr ll INF=2e18; int main(){ ll a; cin >> a; int q; cin >> q; int idx=0; vector

bc; set

st; ll r, s, t; REP(_,q){ cin >> r; if(r==1){ cin >> s >> t; ll x=-a*s*s, y=-a*t*t; ll b=(x-y)/(t-s); ll c=-(x+b*s); bc.push_back({b,c}); if(st.empty()){ st.insert({s+t,idx}); idx++; continue; } auto it=st.lower_bound({s+t,0}); bool ok=0; if(it!=st.end()){ int i=(*it).second; ll ib=bc[i].first, ic=bc[i].second; ll m=(s+t)/2; ll h=-a*m*m+b*m+c; ll ih=-a*m*m+ib*m+ic; if(h>ih) ok=1; } if(it!=st.begin()){ int i=(*prev(it)).second; ll ib=bc[i].first, ic=bc[i].second; ll m=(s+t+1)/2; ll h=-a*m*m+b*m+c; ll ih=-a*m*m+ib*m+ic; if(h>ih) ok=1; } if(ok){ it=st.lower_bound({s+t,0}); while(it!=st.end()){ int i=(*it).second; ll ib=bc[i].first, ic=bc[i].second; ll m=(s+t)/2; ll h=-a*m*m+b*m+c; ll ih=-a*m*m+ib*m+ic; it++; if(h>ih) st.erase(prev(it)); else break; } it=st.lower_bound({s+t,0}); if(!(st.empty()||it==st.begin())){ it--; while(1){ int i=(*it).second; ll ib=bc[i].first, ic=bc[i].second; ll m=(s+t+1)/2; ll h=-a*m*m+b*m+c; ll ih=-a*m*m+ib*m+ic; if(it==st.begin()){ if(h>ih) st.erase(it); break; } else{ it--; if(h>ih) st.erase(next(it)); else break; } } } st.insert({s+t,idx}); } idx++; } else{ cin >> t; auto it=st.lower_bound({t+t,0}); ll ans=0; if(it!=st.end()){ int i=(*it).second; ll ib=bc[i].first, ic=bc[i].second; ll ih=-a*t*t+ib*t+ic; chmax(ans,ih); } if(it!=st.begin()){ int i=(*prev(it)).second; ll ib=bc[i].first, ic=bc[i].second; ll ih=-a*t*t+ib*t+ic; chmax(ans,ih); } cout << ans << endl; } } return 0; }