from _collections import defaultdict
n=int(input())
mod=10**9+7
X=[]
Y=[]
count=0
for i in range(n):
    a,b=map(int,input().split())
    if a==0 or b==0:
        count+=1
    else:
        X.append(-a/b)
        Y.append(b/a)

P=defaultdict(float)
Q=defaultdict(float)
for x in X:
    P[x]+=1
for y in Y:
    Q[y]+=1
print(P)
print(Q)
p=P.keys()
q=Q.keys()
r=p&q
B=[]
for i in r:
    if abs(i)>=1:
        B.append(i)
        
tot=n
ans=1
for i in B:
    ans*=(P[i]+Q[i]+1)
    ans%=mod
    tot-(P[i]+Q[i])
ans*=pow(2,tot,mod)
ans%=mod
ans*=(count+1)
ans%=mod
print(ans)