# ZCC loves march

时间限制：5s 【提交】 空间限制：128MB

### 题目描述

On a m*m land stationed n troops, numbered from 1 to n. The i-th troop's position can be described by two numbers (xi,yi) (1<=xi<=m,1<=yi<=m). It is possible that more than one troop stationed in the same place.

Then there are t minutes, in each minute one of the following two events will occur:

(1)the x-th troop moves towards a direction( Up(U) Down(D) Left(L) Right(R))for d units;(You can suppose that the troops won't move out of the boundary)

(2)the x-th troop needs to regroup the troops which stations in the same row or column with the x-th troop. That is, these troops need to move to the x-th troop's station.

Suggest the cost of i-th troop moving to the j-th troop is (xi-xj)^2+(yi-yj)^2, every time a troop regroups, you should output the cost of the regrouping modulo 10^9+7.

### 输入格式

The first line: two numbers n,m(n<=100000,m<=10^18)

Next n lines each line contain two numbers xi,yi(1<=xi,yi<=m)

Next line contains a number t.(t<=100000)

Next t lines, each line's format is one of the following two formats:

(1)S x d, S∈{U,L,D,R}, indicating the first event(1<=x<=n,0<=d<m)

(2)Q x, indicating the second event(1<=x<=n)

In order to force you to answer the questions online, each time you read x', x=x'⊕lastans("⊕" means "xor"), where lastans is the previous answer you output. At the beginning lastans=0.

### 输出格式

Q lines, i-th line contain your answer to the i-th regrouping event.(modulo 10^9+7)

### 样例输入

5 3 1 3 2 1 2 2 2 3 3 2 6 Q 1 L 0 2 L 5 2 Q 5 R 3 1 Q 3

### 样例输出

1 1 7

### 提示

The input after decode:

Q 1

L 1 2

L 4 2

Q 4

R 2 1

Q 2

### 题目来源

By 镇海中学