from math import gcd
from collections import defaultdict
mod = 10**9+7
n=int(input())
r = defaultdict(int)
for _ in range(n):
  a,b=map(int,input().split())
  if a == 0 and b == 0:
    r[(a,b)]+=1
  elif b == 0:
    r[(1,b)]+=1
  elif a == 0:
    r[(a,1)]+=1
  else:
    g = gcd(a,b)
    if a<0: a,b = -a,-b
    if b < 0:
      r[(abs(a)//g,-abs(b)//g)]+=1
    else:
      r[(abs(a)//g,abs(b)//g)]+=1

def cnt(a,b):
  ra,rb=0,0
  if a in r:ra=r[a]
  if b in r:rb=r[b]
  t = pow(2,ra+rb,mod)
  na = pow(2,ra,mod)-1
  nb = pow(2,rb,mod)-1
  #print(a,b,t,na,nb)
  return t-na*nb
  #return 1
ans = 1
checked = set()
#print(r)
for v in r:
  #print(v)
  if v in checked: continue
  if v == (1,0):
    ans *= cnt(v,(0,1))
    ans %= mod
    checked.add((1,0))
    checked.add((0,1))
  else:
    aibo = (-v[1],v[0])
    if aibo[0]<0:
      aibo = (v[1],-v[0])
    ans *= cnt(v,aibo)
    ans %= mod
    checked.add(v)
    checked.add(aibo)
    
print(ans-1)
    

    