#E
from fractions import gcd
from collections import Counter
N=int(input())

mod=1000000007
ans=1
P=[]
M=[]
zero=0
zero1=0
zero2=0
for i in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        zero+=1
    elif a==0 and b!=0:
        zero1+=1
    elif a!=0 and b==0:
        zero2+=1
    elif (a>0 and b<0) or (a<0 and b>0):
        GCD=gcd(abs(a),abs(b))
        a=abs(a)//GCD
        b=abs(b)//GCD
        P.append(str(a)+"/"+str(b))
        
    else:
        GCD=gcd(abs(a),abs(b))
        a=abs(a)//GCD
        b=abs(b)//GCD
        M.append(str(b)+"/"+str(a))

P_dict=Counter(P)
M_dict=Counter(M)
P_dict["0/0"]=zero1
M_dict["0/0"]=zero2
for v,cnt_p in P_dict.items():
    if v in M_dict:
        cnt_m=M_dict[v]
        ans*=(2**cnt_p+2**cnt_m-1)
        M_dict.pop(v)
    else:
        ans*=2**cnt_p
    ans%=mod
    
for v,cnt_m in M_dict.items():
    ans*=2**cnt_m
    ans%=mod

ans-=1
ans+=zero
ans%=mod
print(ans)