#ds501. 等差数列加

等差数列加

Arithmetic Progression Addition

Problem Description

You are given a sequence a1,a2,…,ana_1, a_2, \dots, a_n which is initially all 00.

You need to support qq operations:

  1. 1 x y d: add dd to every position ii with i≡y(modx)i \equiv y \pmod x.
  2. 2 x: point query the value of axa_x.

Input Format

The first line contains two integers n,qn, q (1≤n,q≤2×1051\leq n, q\leq 2\times 10^5).

The next qq lines each describe an operation, with 1≤x≤n,0≤y<x,1≤d≤1091\leq x\leq n, 0\leq y < x, 1\leq d\leq 10^9 guaranteed.

Output Format

For each query operation, output one number, the answer.

Sample Input

5 6
1 2 1 3
1 3 2 5
2 3
2 5
1 5 0 6
2 5

Sample Output

3
8
14