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

MOD=10**9+7

L_non_zero=[[a,b] for a,b in L if a*b!=0]
L_zero=[[a,b] for a,b in L if a*b==0]

L_zero=0
D_AB=defaultdict(int)
D_BA=defaultdict(int)

for a,b in L:
    if a*b==0:
        L_zero+=1
    else:
        D_AB[a/b]+=1
        D_BA[b/a]+=1


ans=1
used_key=set()
for key,val in D_AB.items():
    if key in used_key:
        continue
    else:
        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 L_zero>0:
    ans*=(L_zero+1)
print((ans-1+MOD)%MOD)
