#P11772. 报社天狗
报社天狗
Description
New issue of Bunbunmaru Newspaper is on sale!
youkais numbered to waits in a line buying the newspaper. Each of them may buy multiple pieces, one single piece or none, depending on their goal — Instead of buying to read, they buy the newspaper to share. One will give a piece of newspaper to everyone whose ID is a multiple of her own ID, even without leaving herself one piece. Youkais numbered to will follow this process in sequence: If the number of newspaper pieces she have is sufficient, she will proceed directly to the giveaway. If not, she will purchase the exact number of newspapers needed before completing the giveaway.
To maximize her profit, Syameimaru Aya, the writer of Bunbunmaru Newspaper, is planning to make a pricing scheme. The scheme is described by two 1-indexed arrays of positive integers , which have a length of each. When a youkai with ID holding pieces of newspaper buy one another piece of newspaper, she should pay yen.
Now Aya needs a fair pricing scheme. She chose to begin adjusting the sequences starting when all elements in and are initialized to . And then there's three types of operations:
-
1 xAya asks you how much revenue she can make in the current state of sequences and . Since the answer could be too large, you should output the answer . -
2 x yAya changes the -th element of array to . -
3 x yAya changes the -th element of array to .
Can you answer all of her questions?
Input Format
The first line of input contains an integer — the amount of operations.
The following rows each contain or integers, representing an operation as described in the problem.
Output Format
For each operation of the first type, print the answer, modulo 2^{32.
5
1 5
2 2 5
3 1 3
1 5
1 6
4
6
12
Hint
Sample Explanation
In the first question, , all the elements in two arrays equal to . the youkai with ID need to buy pieces of newspaper and cost yen for each piece. Other youkais don't need to buy any newspaper. the revenue in total will be yen.
In the second question, , other elements in two arrays equal to . the youkai with ID need to buy pieces of newspaper and cost yen for the first piece, yen for the other pieces. Other youkais don't need to buy any newspaper. the revenue in total will be yen.
In the third question, , other elements in two arrays equal to . Let's check out the details in this question:
-
The youkai with ID needs to give other youkais one pieces of newspaper each, but she has none, so she needs to buy pieces of newspaper. the first piece costs yen and the others cost yen each.
-
The youkai with ID needs to give youkais with ID or one pieces of newspaper each. She has got a piece from the youkai with ID , so she needs to buy piece of newspaper which costs yen.
-
The youkai with ID needs to give youkai with ID one piece of newspaper, she has got a piece from the youkai with ID , so she doesn't need to buy newspaper.
-
the youkais with ID don't need to give out newspaper, so they doesn't need to buy newspaper.
the revenue in total will be yen.
Constraints
Subtasks applied. You can only gain the score of the subtask if you accepted all the tests in the subtask.
| Subtask ID | Special Property | Score |
|---|---|---|
| No modification operations exist | ||
| in every operation of first type is same | ||
| - |
For all tests, it is guaranteed that ,.
京公网安备 11011102002149号