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,...,an. Your task is to perform on it m consecutive operations of the following type:
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 n and m (1≤n,m≤2·105) − the number of integers in the sequence and the number of operations, correspondingly. The second line contains n integers a1,a2,...,an (0≤ai≤105). Then follow m lines, each describes an operation. Each line starts with an integer ti (1≤ti≤3) − the operation type:
The input limits for scoring 30 points are (subproblem E1):
The input limits for scoring 70 points are (subproblems E1+E2):
The input limits for scoring 100 points are (subproblems E1+E2+E3):
For each query print the calculated sum modulo 1000000000 (109).
5 5
1 3 1 2 4
2 1 4
2 1 5
2 2 4
1 3 10
2 1 5
12
32
8
50
5 4
1 3 1 2 4
3 1 4 1
2 2 4
1 2 10
2 1 5
12
45