402351: GYM100735 F Ellipses

Memory Limit:128 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

F. Ellipsestime limit per test1 secondmemory limit per test128 megabytesinputstandard inputoutputstandard output

Informikas has married recently, and although the quality of his life has improved since then, his wife does not approve some of his mathematical games which he plays on his own table!

The table has an elliptical form, which means that it is very similar to a circle, and there are no corners, therefore, Informikas's future children will not accidentally hit their heads to a corner of a table. This would hurt and Informikas knows that pain is a terrible emotion, and it is better to avoid it at all. As a result, Informikas is completely satisfied with the form of the table. However, the form of the table is unimportant in this problem (Informikas just wanted to brag about his table).

What Informikas does on his table is more important, which usually is playing with a lot of ellipses, conveniently numbered from 1 to n. Although some of his ellipses might disappear (and you will soon learn why), they are never renumbered. One elliptical figure is characterized by half of the length of its major axis, and half of the length of its minor axis. We will refer to these numbers as a and b.

Similar numbers A and B correspond to a and b, and they are called 'wife's tolerance numbers'. If ai > A or bi > B, the wife starts to think that the i-th ellipse takes up too much space, and she immediately disposes it to a recycle bin! As opposite to this, if ai ≤ 0 or bi ≤ 0, the ellipse just disappears from the table and never reappears again.

You have to process those queries:

Type 1: given l, r and v, you need to set ai = v, for all i in [l; r].

Type 2: given l, r and v, you need to set bi = v, for all i in [l; r].

Type 3: given l, r and v, you need to set ai = ai + v, for all i in [l; r].

Type 4: given l, r and v, you need to set bi = bi + v, for all i in [l; r].

Type 5: given l and r, you need to print the sum of the areas of ellipses numbered from l to r, divided by π. If an ellipse in the interval does not lay on the table, its area is assumed to be 0.

Type 6: given l and r, you need to print the number of ellipses numbered from l to r, which still lay on the table.

Input

The first line of the input contains n and m (1 ≤ n, m ≤ 105) - the number of ellipses and the number of queries respectively.

The following line contains 2n integers, the i-th pair describes the initial a and b of the i-th ellipse (1 ≤ a, b ≤ 106).

The following m lines describe queries in the format t, l, r and v (if needed) (1 ≤ t ≤ 6, 1 ≤ l ≤ r ≤ n,  - 106 ≤ v ≤ 106) - the type of query, the endpoints of the given interval and the modification value. All numbers are integers, and they are separated by spaces.

On the last line of the input there are numbers A and B (1 ≤ A, B ≤ 106).

Output

For each type 5 or type 6 query print one line with the corresponding answer.

ExamplesInput
1 3
1 1
6 1 1
3 1 1 1
6 1 1
1 1
Output
1
0

加入题单

算法标签: