CF316E3.Summer Homework

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher:

You are given a sequence of integers a1,a2,...,ana_{1},a_{2},...,a_{n} . Your task is to perform on it mm consecutive operations of the following type:

  1. For given numbers xix_{i} and viv_{i} assign value viv_{i} to element axia_{xi} .
  2. For given numbers lil_{i} and rir_{i} you've got to calculate sum , where f0=f1=1f_{0}=f_{1}=1 and at i>=2i>=2 : fi=fi1+fi2f_{i}=f_{i-1}+f_{i-2} .
  3. For a group of three numbers lil_{i} rir_{i} did_{i} you should increase value axa_{x} by did_{i} for all xx (li<=x<=ri)(l_{i}<=x<=r_{i}) .

Smart Beaver planned a tour around great Canadian lakes, so he asked you to help him solve the given problem.

输入格式

The first line contains two integers nn and mm ( 1<=n,m<=21051<=n,m<=2·10^{5} ) — the number of integers in the sequence and the number of operations, correspondingly. The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 0<=ai<=1050<=a_{i}<=10^{5} ). Then follow mm lines, each describes an operation. Each line starts with an integer tit_{i} ( 1<=ti<=31<=t_{i}<=3 ) — the operation type:

  • if ti=1t_{i}=1 , then next follow two integers xix_{i} viv_{i} ( 1<=xi<=n,0<=vi<=1051<=x_{i}<=n,0<=v_{i}<=10^{5} );
  • if ti=2t_{i}=2 , then next follow two integers lil_{i} rir_{i} ( 1<=li<=ri<=n1<=l_{i}<=r_{i}<=n );
  • if ti=3t_{i}=3 , then next follow three integers lil_{i} rir_{i} did_{i} ( 1<=li<=ri<=n,0<=di<=1051<=l_{i}<=r_{i}<=n,0<=d_{i}<=10^{5} ).

The input limits for scoring 3030 points are (subproblem E1):

  • It is guaranteed that nn does not exceed 100100 , mm does not exceed 1000010000 and there will be no queries of the 33 -rd type.

The input limits for scoring 7070 points are (subproblems E1+E2):

  • It is guaranteed that there will be queries of the 11 -st and 22 -nd type only.

The input limits for scoring 100100 points are (subproblems E1+E2+E3):

  • No extra limitations.

输出格式

For each query print the calculated sum modulo 10000000001000000000 (109)(10^{9}) .

输入输出样例

  • 输入#1

    5 5
    1 3 1 2 4
    2 1 4
    2 1 5
    2 2 4
    1 3 10
    2 1 5
    

    输出#1

    12
    32
    8
    50
    
  • 输入#2

    5 4
    1 3 1 2 4
    3 1 4 1
    2 2 4
    1 2 10
    2 1 5
    

    输出#2

    12
    45
    
首页