#include using i64 = long long; using u64 = unsigned long long; using u32 = unsigned; using u128 = unsigned __int128; using i128 = __int128; bool check(i64 a1, i64 b1, i64 a2, i64 b2, i64 a3, i64 b3) { return (i128)(a2 - a1) * (b3 - b2) < (i128)(b2 - b1) * (a3 - a2); } void solve() { i64 a; int Q; std::cin >> a >> Q; std::set> ch; while(Q --) { int q; std::cin >> q; if(q == 1) { i64 s, t; std::cin >> s >> t; std::pair add = std::make_pair(s + t, - s * t); auto it = ch.lower_bound(add); if(it != ch.begin() && it != ch.end()) { auto it2 = it; it2 --; if(!check(it2 -> first, it2 -> second, add.first, add.second, it -> first, it -> second)) continue; } it = ch.insert(add).first; while(1) { auto it2 = it, it3 = it; it2 ++; it3 ++; if(it2 == ch.end()) break; it3 ++; if(it3 == ch.end()) break; if(check(it -> first, it -> second, it2 -> first, it2 -> second, it3 -> first, it3 -> second)) break; ch.erase(it2); } while(1) { auto it2 = it, it3 = it; if(it2 == ch.begin()) break; it2 --; it3 --; if(it3 == ch.begin()) break; it3 --; if(check(it3 -> first, it3 -> second, it2 -> first, it2 -> second, it -> first, it -> second)) break; ch.erase(it2); } } else{ i64 t; std::cin >> t; while(!ch.empty()) { auto it = ch.begin(); auto it2 = it; it2 ++; if(it2 == ch.end()) break; if(t * it -> first + it -> second <= t * it2 -> first + it2 -> second) ch.erase(it); else break; } if(ch.empty()) std::cout << 0 << "\n"; else { auto it = ch.begin(); i64 ans = a * (- t * t + t * it -> first + it -> second); std::cout << std::max(0LL, ans) << "\n"; } } } } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int T = 1; //std::cin >> T; while (T--) { solve(); } return 0; }