Today s kilometer long auto race takes place in Berland. The track is represented by a straight line as long as s kilometers. There are n cars taking part in the race, all of them start simultaneously at the very beginning of the track. For every car is known its behavior − the system of segments on each of which the speed of the car is constant. The j-th segment of the i-th car is pair (vi,j,ti,j), where vi,j is the car's speed on the whole segment in kilometers per hour and ti,j is for how many hours the car had been driving at that speed. The segments are given in the order in which they are "being driven on" by the cars.
Your task is to find out how many times during the race some car managed to have a lead over another car. A lead is considered a situation when one car appears in front of another car. It is known, that all the leads happen instantly, i. e. there are no such time segment of positive length, during which some two cars drive "together". At one moment of time on one and the same point several leads may appear. In this case all of them should be taken individually. Meetings of cars at the start and finish are not considered to be counted as leads.
Output
Print the single number − the number of times some car managed to take the lead over another car during the race.