import math
N=int(input())
A=[0]*N
B=[0]*N
x=0
y=0
plus={}
ans=1
for i in range(N):
  a,b=map(int,input().split())
  A[i]=a
  B[i]=b
  if(a==0 and b!=0):
    x+=1
  elif(a!=0 and b==0):
    y+=1
  elif(a!=0 and b!=0):
    if(a/b-b/a in plus):
      plus[a/b-b/a]+=1
    else:
      plus[a/b-b/a]=1
#print(plus)
#print(x)
#print(y)
for z in plus.values():
  ans*=(z+1)%(10**9+7)
ans*=(2**x+2**y-1)%(10**9+7)
print((ans-1)%(10**9+7))