Diamond Hands

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

The "Diamond Hands" corporation has a long and eventful history. Starting from its foundation, they had a lot of successful and unsuccessful days. For simplicity, let's consider a day successful if its stock price increased by one (in abstract units). Similarly, we consider a day unsuccessful if its stock price decreased by one. As it often happens, successful days come in long streaks, as do unsuccessful days. There is no middle ground: every day is either successful or unsuccessful.

You would like to figure out which days were successful and unsuccessful for the corporation. To accomplish it, you obtained the historical stock price data: nn pairs  (d_i,p_i)(d\_i, p\_i), meaning that after d_id\_i days after issuing stock the difference with the starting stock price was p_ip\_i units (p_ip\_i can be an arbitrary integer, including any negative number).

Represent the corporation's history with the minimum number of successful or unsuccessful day streaks, or report that data contains an error and it's impossible to achieve it. If there are multiple possible answer with the minimum number of streaks, output any one of them.

입력

The first line of the input contains an integer nn (1n200,0001 \le n \le 200\\,000). Next nn lines contain a pair of integers d_i;p_id\_i \\; p\_i each (1d_i1081 \le d\_i \le 10^8; 108p_i108-10^8 \le p\_i \le 10^8; d_i<d_i+1d\_i < d\_{i+1} for all ii from 11 to n1n - 1).

출력

If there are errors in the historical stock price data, output 1-1. Otherwise, print kk, the number of streaks, in the first line. Next, print kk lines describing successful or unsuccessful streaks. Each line should contain a pair l_i;c_il\_i \\; c\_i (1l_i1081 \le l\_i \le 10^8; c_i+,-c\_i \in \\{\texttt{+}, \texttt{-}\\}), meaning that the next streak lasted for l_il\_i days, and was successful if c_i=+c\_i = \texttt{+}, or unsuccessful if c_i=-c\_i = \texttt{-}.

The description of streaks must be done in chronological order, starting from the day stock was issued and ending on day d_nd\_n. This means that the sum of all l_il\_i must be equal to d_nd\_n.

힌트

In the first example, first three days are successful, so after 2 days the difference is 2, and after 3 days the difference is 3. Next three days are unsuccessful, so after 5 days the difference becomes 1, and after 6 days the stock price is back to the initial value. The last seventh day is successful, so the final difference after 7 days is 1.