from collections import defaultdict as dd def main(): n = int(input()) Q = int(input()) Ai = dd(int) B = [1]* (n+1) X = [0]* (n+1) Y = [0]* (n+1) for q in range(Q): tmp = input() if tmp[0] == "a": direction, k = tmp.split() k = int(k) answer = 1 for key, value in Ai.items(): if k >= key: answer += value answer %= 10**9 + 7 else: break print(answer) continue direction, k, param = tmp.split() param = int(param) k = int(k) if direction == "y": tmp = B[k+1]**2 B[k+1] += (param - Y[k]) * B[k] Ai[k+2] += X[k+1] * (B[k+1]**2 - tmp) Y[k] = param elif direction == "x": Ai[k+1] += (param - X[k]) * (B[k]**2) X[k] = param # print("Ai",Ai) # print("B",B) if __name__ == "__main__": main()