from collections import defaultdict
import math
d = defaultdict(int)
n = int(input())
mod = 10**6+7
for i in range(n):
  a, b = map(int, input().split())
  if a ==0:
    A = 0
    B = 1
  elif b ==0:
    A = 1
    B = 0
  if b > 0:
    A = a//math.gcd(a,b)
    B = b//math.gcd(a,b)
  else:
    A = -a//math.gcd(a,b)
    B = -b//math.gcd(a,b)
  d[(A, B)] += 1

def pair(key):
  if key == (1, 0):
    return (0, 1)
  A, B = key
  return (B, -A)

for i in d:
  j = pair(i)
  
  ans += d[i]%mod * d[j]%mod
print(ans%mod)