from collections import Counter
n = int(input())
pp = []
a0 = 0
b0 = 0
z = 0
for i in range(n):
  a,b = map(int,input().split())
  if a*b == 0:
    if a==0 and b==0:
      z += 1
    elif a==0:
      a0 += 1
    else:
      b0 += 1
  else:
    pp.append(a/b)
    
mod = 10**9+7
a0 %= mod
b0 %= mod
z %= mod
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)+pow(2,chk,mod)-1)%mod
  r %= mod
  s.add(-1/i)
  
r *= (pow(2,a0,mod)+pow(2,b0,mod)-1)%mod
r %= mod
print((r+z-1)%mod)