from collections import defaultdict
import bisect
N=int(input())
L = [list(map(int,input().split())) for _ in range(N)]

MOD=10**9+7


L =sorted(L)

L_non_zero=[[a,b,i] for i,[a,b] in enumerate(L) if a*b!=0]
L_zero=[[a,b,i] for i,[a,b] in enumerate(L) if a*b==0]

D_AB=defaultdict(int)
D_BA=defaultdict(int)


A_B=[]
B_A=[]
for a,b,i in L_non_zero:
    D_AB[a/b]+=1
    D_BA[b/a]+=1
    A_B.append([a/b,i])
    B_A.append([b/a,i])


ans=pow(2,N,MOD)-1

ans=1
used_key=set()
NG=[]
NG_each=len(L_zero)
for key,val in D_AB.items():
    if key in used_key:
        continue
    else:
        used_key.add(key)
        used_key.add(-1/key)
    val_other=D_BA[-key]

    if val_other==0:
        ans*=pow(2,val,MOD)
    else:
        ans*=((pow(2,val,MOD)-1)+(pow(2,val_other,MOD)-1)+1)
if NG_each>0:
    ans*=NG_each
print((ans-1+MOD)%MOD)
