CSES - KILO 2018 3/5 - Kangaroo Keeping
  • Time limit: 2.00 s
  • Memory limit: 512 MB

Uolevi recently got a job as a kangaroo keeper. Unfortunately, some of his kangaroos immediately escaped, and Uolevi is in pursuit.

The kangaroo farm has mm different kinds of kangaroos, where the ii'th type of kangaroo moves exactly ii meters per jump. To find the escaped kangaroos, Uolevi wants to calculate the amount of kangaroo footprints in the interval [a,b][a, b] of the road. When a kangaroo of type ii escapes, it leaves a footprint at positions xixi along the road, where x>0x > 0 is a positive integer.

There are two kinds of events that can happen:

  • A kangaroo of type ii escapes, leaving footprints at positions ii, 2i2i, and so on
  • Uolevi counts the number of footprints in the interval [a,b][a, b].

Can you find the number of footprints Uolevi counts on each interval?

Input

The first line of input contains three integers nn, mm and qq: the length of the road, the amount of kangaroo types, and the number of events.

After this, qq lines follow, each of one of the two following types:

  • 11 jj: A kangaroo of type jj escapes, leaving footprints at positions xjxj, where x>0x > 0 is a positive integer
  • 22 aa bb: Uolevi counts the amount of footprints in the interval [a,b][a, b]

Output

Print kk lines where kk is the amount of queries of type 22. On every such line, print the amount of footprints on the interval.

Constraints

  • 1n,m,q1051 \leq n, m, q \leq 10^{5}
  • 1jm1 \leq j \leq m
  • 1abn1 \leq a \leq b \leq n

Example

Input:

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

Output:

4
3