N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]

MOD = 1000000007
from collections import defaultdict
from fractions import Fraction

zero_zero_count = 0
zero_one_count = 0
one_zero_count = 0
dd_ba = defaultdict(int,{})
dd_ab = defaultdict(int,{})
for a,b in AB:
  if (a==0)and(b==0):
    zero_zero_count += 1
  elif (a==0):
    zero_one_count += 1
  elif (b==0):
    one_zero_count += 1
  else:
    dd_ba[Fraction(-b, a)] += 1
    dd_ab[Fraction(a, b)] += 1
  

ans = (2**zero_one_count + 2**one_zero_count -1)
flag_dd = defaultdict(bool,{})
for key,value in dd_ba.items():
  if flag_dd[key]:
    continue
  ans *= (2**dd_ab[key] + 2**value - 1) % MOD
  ans %= MOD
  flag_dd[Fraction(key.denominator, -(key.numerator))] = True
  
ans += zero_zero_count - 1
print(ans%MOD) 