n = int(input())
c = 0
pp = []
mm = []
for i in range(n):
  a,b = map(int,input().split())
  if a*b == 0:
    c += 1
  else:
    pp.append(a/b)
    
mod = 10**9+7
from collections import Counter
p = Counter(pp)
r = 1
s = set()
for i in p.keys():
  if i in s:
    continue
  ans = p[i]
  chk = p[-1/i]
  r *= (pow(2,ans,mod)-1+pow(2,chk,mod))%mod
  r %= mod
  s.add(-1/i)
print(r*(c+1)%mod-1)