from fractions import Fraction
import sys
input = sys.stdin.readline
N=int(input())
mod=10**9+7
dic={}
c=0
d=0
e=0
for i in range(N):
 A,B = map(int,input().split())
 if A==0 and B==0:
  e+=1
 elif A==0:
  c+=1
 elif B==0:
  d+=1
 else:
   x=Fraction(A,B)
   if x in dic:
    dic[x][0]+=1
   elif -1/x in dic:
    dic[-1/x][1]+=1
   else:
    dic[x]=[1,0]
ans=1
for k in dic:
 ans*=(pow(2,dic[k][0],mod)+pow(2,dic[k][1],mod) -1)
 ans%=mod
ans*=(pow(2,c,mod)+pow(2,d,mod)-1)
print((ans-1+e)%mod)
