Bessie is a hungry cow. Each day, for dinner, if there is a haybale in the barn, she will eat one haybale. Farmer John does not want Bessie to starve, so some days he sends a delivery of haybales, which arrive in the morning (before dinner). In particular, on day d_i, Farmer John sends a delivery of b_i haybales (1≤d_i≤1014, 0≤b_i≤109).
Process U (1≤U≤105) updates as follows: Given a pair (d,b), update the number of haybales arriving on day d to b. After each update, output the sum of all days on which Bessie eats haybales modulo 109+7.
U, followed by U lines containing the updates.
The sum after each update modulo 109+7.