import bisect,sys
input = sys.stdin.readline
n=int(input())
ans=[0]*n
ans[0]=2
ans[-1]=1
mod=10**9+7
l=[0]*n
d={}
for i in range(n):
  a,b=map(float,input().split())
  if b==0:
    l[i]=0
  else:
    l[i]=a/b
l.sort()
z=bisect.bisect_right(l,0)
for i in range(1,z):
  ans[i]=(ans[i-1]*2)%mod
for i in range(z,n) :
  x=l[i]
  le=bisect.bisect_left(l,-1/x)
  r=bisect.bisect_right(l,-1/x)
  if le==r:
    ans[i]=(ans[i-1]*2)%mod
  else:
    z=bisect.bisect_left(l,x)   
    if i==z:
      ans[i]=ans[i-1]+2**(i-(r-le))
    else:
      ans[i]=ans[i-1]+ans[z]//2
print((ans[-1]-1)%mod)
  