import sys
#import numpy as np
#import math
from fractions import Fraction
import itertools

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)
input=sys.stdin.readline

ans=1
mod=10**9+7
n0=0
na=nb=0
n=int(input())
v=tuple(tuple(map(lambda x: int(x),input().split())) for _ in range(n))
d={}
for i in range(n):
    b= v[i][1]
    a= v[i][0]
    if b==0 or a==0:
        n0+=1
    elif b==0:
        nb+=1
    elif a==0:
        na+=1
    else:
        if Fraction(a, b) not in d:
            d[Fraction(a, b)]=1
        else:
            d[Fraction(a, b)]+=1
            
for i in d.keys():
    if Fraction(-1,i) in d:
        if i>0:
        	ans*=pow(2,d[Fraction(-1, i)],mod)-1+pow(2,d[i],mod)-1+1
        	ans=ans%mod
    else:
        ans*=pow(2,d[i],mod)-1+1
        ans=ans%mod
ans*=(pow(2,na,mod)-1+pow(2,nb,mod)-1+1)
print(ans-1)