import sys
from decimal import *
#read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def read():
  return int(readline())
def reads():
  return map(str, input().split())
n=read()
mod=1000000007
dic={}
multi=1
for i in range(n):
  a,b=reads()
  a=Decimal(a)
  b=Decimal(b)
  try :
    sum=a/b
    comp=-b/a
  except:sum=comp=0
  if sum>0:
      try:
        dic[(sum,comp)][0]+=1
      except:
        try:
            dic[(comp,sum)][0]+=1
        except:
            dic[(sum,comp)]=[1,0]
  elif sum<0:
      try:
        dic[(sum,comp)][1]+=1
      except:
        try:
            dic[(comp,sum)][1]+=1
        except:
            dic[(sum,comp)]=[0,1]
  else:
      multi=2
ans=1
#print(dic)
for ls in dic:
    p=2**dic[ls][0]-1
    q=2**dic[ls][1]-1
    ans*=p+q+1
    ans%=mod

print((ans*multi-1)%mod)
