URI Online Judge | 2244

Olympic Games

By Maratona de Programação da SBC 2016 BR Brazil

Timelimit: 1

A group of investors are thinking of investing heavily in athletes of the Brazilian delegation after the Olympics in Rio. For this, they have observed N athletes and realized that some are in decay and others rising. In particular, the group is looking at two factors on each athlete: his weariness and his ability. They noted the ability scores and fatigue of each athlete soon to end the 2016 Olympics Then the group estimated the rate at which each athlete loses or gains skill and the rate at which each athlete gets tired over time, and realized that these rates are constant for both attributes.

Investors realized that these data allow them to define what they decided to call the golden athlete: an athlete who, in a given period of time, the athlete is less tired and more skilled. It was decided that investments will be made only in gold athletes. Find out how many players, between the observed initially receive some investment. Assume that time t = 0 is the time of upcoming Rio: no athlete gold was before that time can receive investment. Also consider that any time after the Rio Olympics should be considered, however large. An athlete is gold exactly at t = 0 time should be counted.


The first row entry contains an integer N (1 ≤ N ≤ 105), the number of athletes. Following N lines, each with four integers: Hi, Hti , Ci, Cti (-106 < Hi, Hti , Ci, Cti ≤ 106, Hti, Cti ≠ 0), representing, respectively, the ability at the end of the Olympics, the ability change rate, tiredness at the end of the olympics and the rate of change of the ith athlete fatigue.


Your program should produce a single line with an integer O, representing the number of athletes who receive some investment group.

Input Samples Output Samples

3 2 1 2
2 2 2 2
1 2 3 2


1 10 5 8
8 7 12 -5
10 -2 -3 8
-3 -5 -8 -12
0 1 10 2
8 3 9 -3