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

input=sys.stdin.readline

ans=1
mod=10**9+7
n0=0
na=nb=0
n=int(input())
d={}
for i in range(n):
    a,b=map(int,input().split())
    if b==0 and 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)])-1+pow(2,d[i])-1+1
        	ans=ans%mod
    else:
        ans*=pow(2,d[i])
        ans=ans%mod
ans*=pow(2,na)-1+pow(2,nb)-1+1
print((ans-1)%mod)