During the annual interstellar competition for tuned spaceships, N spaceships compete. Each spaceship i is tuned so that it can accelerate in zero time to its maximum speed Vi and then cruise at that speed forever. Because of past achievements, each spaceship starts at position Xi, i.e. it begins Xi kilometers past the starting line.
The race course is infinitely long. Because the spaceships move so fast, the course runs perfectly straight the whole way. On this straight course, spaceships can pass one another very easily, without interfering with each other.
Many spectators have not yet realized that the outcome of the race can be determined in advance. Your task is to show this: report how many times spaceships pass one another, and predict the first 10000 passings in chronological order.
You may assume that every spaceship starts at a different position. Furthermore, no more than two spaceships are ever at the same position on the course at the same time.
The input consists of several races. The first line of each race contains the number of spaceships N (0<N≤250000). Each of the next N lines describes one spaceship: the (i+1)-th line contains two integers Xi and Vi, the starting position and the velocity of the i-th spaceship (0≤Xi≤1000000, 0<Vi<100). The spaceships are ordered by starting position, i.e. X1<X2<⋯<XN. The starting position is the number of kilometers past the starting line where the spaceship starts, and the velocity is given in kilometers per second.
The input is terminated by a race with 0 spaceships; no output should be produced for that race.
For each race, output the following. The first line contains the number of times spaceships pass one another during the race, taken modulo 1000000.
Each of the following lines represents one passing, in chronological order. If there are more than 10000 passings, output only the first 10000; if there are fewer than 10000, output all of them. Each line consists of two integers i and j, meaning that spaceship i passes spaceship j. If several passings happen at the same time, sort them by their position on the course: a passing that takes place closer to the starting line is listed first. The time of a passing is the moment when the two spaceships are at the same position.