To earn some extra money, the cows have opened a milkshake restaurant in their barn. The restaurant has $N$ seats in a single row ($1 \le N \le 500000$), and every seat is empty at the start of the day.
Over the course of the day, $M$ events happen in sequence ($1 \le M \le 300000$). Each event is one of two kinds:
Count the total number of parties that are turned away during the day.
A p means a party of size $p$ arrives; a line L a b means every customer in the seat range $[a, b]$ leaves.Here is a walkthrough of the first example. There are 10 seats and 4 events. First, a party of 6 arrives and takes seats 1–6. Then everybody in seats 2–4 leaves. Next, a party of 5 arrives, but no block of 5 consecutive empty seats exists, so it is turned away. Finally, a party of 2 arrives and takes the empty seats 2–3. Only the third party is turned away.