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):
    c=math.gcd(a**2-b**2,a*b)
    d=(a**2-b**2)//c
    e=(a*b)//c
    if(e<0):
      d*=-1
      e*=-1
    if((d,e) in plus):
      plus[(d,e)]+=1
    else:
      plus[(d,e)]=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))