from math import gcd
N=int(input())
mod=10**9+7

zero=0
slope={}
for i in range(N):
    a,b=map(int,input().split())
    if a==0 and b==0:
        zero+=1
        continue
    elif a==0:
        s="0/1"
    elif b==0:
        s="1/0"
    else:
        g=gcd(abs(a),abs(b))
        a//=g
        b//=g
        if b<0:
            a*=-1
            b*=-1
        s=str(a)+"/"+str(b)
    if s in slope:
        slope[s]+=1
    else:
        slope[s]=1

ans=1
rem=[]
for s in slope:
    b2,a2=map(int,s.split("/"))
    if a2!=0 and b2!=0:
        a2*=-1
    if b2<0:
        a2*=-1
        b2*=-1
    s_inv=str(a2)+"/"+str(b2)
    if s_inv in slope:
        rem.append((pow(2,slope[s],mod)-1)*(pow(2,slope[s_inv],mod)-1)%mod)
ans=pow(2,N-zero,mod)-1+zero-(sum(rem)//2)%mod
print(ans%mod)