\begin{problem}{Feed the headcrab}{gonarch.in}{gonarch.out}{3 sec}{256 Mb}

%Автор задачи: Виталий Демьянюк
%Автор условия: Антон Ковшаров

Gonarch is a well-known headcrab of the planet Xena. He is not only a terrible monster, but also a loving father. 
Like any father, Gonarch is committed to feed all his children. But there are too many of them, so he asked some
adults headcrabs to help him. 

When headcrab, authorized feed a group of $k$ larvae, receive $n$ units of food, he gives each larva the maximum 
possible integer number of units of food, such that all $k$ larvae receive equal amount. 
The rest of the food he eats by himself.

Gonarch wants to know how many units of food is eaten by the adult headcrabs.
You need to write a program that reads the initial configuration and responds to requests. The program should 
handle the following events:

\begin{itemize} 
\item + $k$ : new headcrab appeared, who feed a group of $k$ larvae. 
\item - $k$ : one of headcrabs, who feed a group of $k$ larvae left them and went to hunt for human brains. 
\item ? $n$ : Gonarch give each headcrab $n$ units of food. The program should output the number of units of food that was eaten by adult headcrabs. 
\end{itemize}
                                                                                                                                             
\InputFile

The first line contains the number $m$, the number of different sizes of groups that existed 
before the start of the program ($0\le m\le 10^5$). The following $m$ lines contain 
descriptions of existing groups. In the $i + 1$-th line contains two numbers $g_i$ and 
$c_i$, group size and the number of these groups, respectively ($1 \le g_i, c_i \le 10^5$). 
It is guaranteed that all $g_i$ are different. 

Next line of input contains the number of requests $t$ ($1 \le t \le 10^5$). 
Next $t$ lines contain requests, one per line. Requests may be one of the following: 
\begin{itemize} 
\item + $k$: add new headcrab, feeding $k$ larvae ($1 \le k \le 10^5$).
\item - $k$: remove headcrab, feeding $k$ larvae ($1 \le k \le 10^5 $)
It is guaranteed that at the time of executing the request, there is at least one headcrab with such number of larvae. 
\item ? $n$: give all the headcrabs $n$ units of food ($1 \le n \le 10^5$).
\end{itemize} 

\OutputFile 
For each request of third type output the number of units of food that is eaten by adult headcrabs.

\Examples
\begin{example}%
\exmp{
1
2 1
7
+ 3
+ 2
? 5
- 2
? 7
- 2
? 4
}{
4
2
1
}%
\end{example}

\Note
Solutions that work when $\t \le 10^3$ will get 20 points.

Solutions that work when $m = 0$ and $\t \le 10^4$ will get 20 points.

Solutions that work when there is no requests of removing the headcrab, and no two headcrab have the same number of larvae will get 20 points.
                    
\end{problem}

