import bisect
import math
mod = 10**9 + 7
n = int(input())
a = [0] *n
b = [0] * n
oo = 0
ao = 0
bo = 0
ab = [0] * n
ba = [0] * n

for i in range(n):
  A,B = map(int, input().split())
  a[i] = A
  b[i] = B
  if A == 0 & B == 0:
    oo += 1
  elif A == 0:
    ao += 1
  elif B == 0:
    bo += 1
  else:
    ab[i] = A/B
    ba[i] = -B/A

na = 0
np = 0
ab.sort()
ba.sort()
for i in range(n):
  j = bisect.bisect_left(ba, ab[i])
  if j < n:
    if ba[j] == ab[i]: na += 1
    if j+1 >= n:continue
    j += 1
    while ba[j] == ab[i]:
      np = na + 1
      if j > n:break
      j += 1

na += ao + bo + oo
np += ao * bo
np += oo*(n-1)

ans = 1
for k in range(1,n):
  ans += (math.factorial(n) / (math.factorial(k) * math.factorial(n-k))) % mod

for _ in range(np):
  m = 2
  for k in range(m,n+1):
    ans -= (math.factorial(n-m) / (math.factorial(k-m) *  math.factorial(n-k))) % mod

for d in range(3,na+1):
  for k in range(d,n+1):
    ans += (math.factorial(n-d) / (math.factorial(k-d) *  math.factorial(n-k))) % mod

print(int(ans))