from bisect import bisect_left class Bit: def __init__(self, n): self.size = n self.tree = [0] * (n + 1) def sum(self, i): i += 1 s = 0 while i > 0: s += self.tree[i] i -= i & -i return s def sumrange(self, i, j): si = self.sum(i - 1) sj = self.sum(j) return sj - si def add(self, i, x): i += 1 while i <= self.size: self.tree[i] += x i += i & -i def lower_bound(self, w): if w <= 0: return 0 x = 0 r = 1 << (self.size).bit_length() while r > 0: if x+r < self.size and self.tree[x+r] < w: w -= self.tree[x+r] x += r r = r >> 1 return x Ga = int(input()) Q = int(input()) query = [list(map(int, input().split())) for _ in range(Q)] lines = [[-1, -10**9]] for q in query: if len(q) == 3: s, t = q[1:] lines.append([s+t, -s*t]) lines.sort() def isneed(ismax, f1, f2, f3): va = (f3[1]-f2[1])*(f2[0]-f1[0]) vb = (f2[1]-f1[1])*(f3[0]-f2[0]) if ismax: return va < vb else: return va > vb def f(ind, t): b, c = lines[ind] return t*b+c state = Bit(Q+2) state.add(0, 1) ans = [] ct = 1 for q in query: if q[0] == 1: s, t = q[1:] b, c = s+t, -s*t ind = bisect_left(lines, [b, c]) w = state.sum(ind-1) if 0 < w < ct: indl = state.lower_bound(w) indr = state.lower_bound(w+1) if not isneed(1, lines[indl], lines[ind], lines[indr]): continue state.add(ind, 1) ct += 1 while w+2 < ct: indr0 = state.lower_bound(w+2) indr1 = state.lower_bound(w+3) if not isneed(1, lines[ind], lines[indr0], lines[indr1]): state.add(indr0, -1) ct -= 1 else: break while 1 < w: indl0 = state.lower_bound(w-1) indl1 = state.lower_bound(w) if not isneed(1, lines[indl0], lines[indl1], lines[ind]): state.add(indl1, -1) ct -= 1 w -= 1 else: break else: t = q[1] res = 0 if ct == 1: ind = state.lower_bound(1) res = f(ind, t) else: ind0 = state.lower_bound(1) res = f(ind0, t) while ct > 1: ind1 = state.lower_bound(2) res1 = f(ind1, t) if res < res1: state.add(ind0, -1) ind0 = ind1 res = res1 ct -= 1 else: break ans.append(max(0, (-t**2+res)*Ga)) print(*ans, sep='\n')