

Wow! Such Sequence!Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 6221 Accepted Submission(s): 1761 Problem Description Recently, Doge got a funny birthday present from his new friend, Protein Tiger from St. Beeze College. No, not cactuses. It's a mysterious blackbox. After some research, Doge found that the box is maintaining a sequence an of n numbers internally, initially all numbers are zero, and there are THREE "operations": 1.Add d to the kth number of the sequence. 2.Query the sum of ai where l ¡Ü i ¡Ü r. 3.Change ai to the nearest Fibonacci number, where l ¡Ü i ¡Ü r. 4.Play sound "Cheerio!", a bit useless. Let F_{0} = 1,F_{1} = 1,Fibonacci number Fn is defined as F_{n} = F_{n  1} + F_{n  2} for n ¡Ý 2. Nearest Fibonacci number of number x means the smallest Fn where F_{n}  x is also smallest. Doge doesn't believe the machine could respond each request in less than 10ms. Help Doge figure out the reason. Input Input contains several test cases, please process till EOF. For each test case, there will be one line containing two integers n, m. Next m lines, each line indicates a query: 1 k d  "add" 2 l r  "query sum" 3 l r  "change to nearest Fibonacci" 1 ¡Ü n ¡Ü 100000, 1 ¡Ü m ¡Ü 100000, d < 2^{31}, all queries will be valid. Output For each Type 2 ("query sum") operation, output one line containing an integer represent the answer of this query. Sample Input
Sample Output
Author Fudan University Source  
