n = int(input())
d={}
s=set([])
x=0
y=0
z=0
c=0
ans=1
N=1000000007
for i in range(n):
    a,b =map(int,input().split())
    if (a==0) and (b!=0):
        x+=1
    elif (a!=0) and (b==0):
        y+=1
    elif (a==0) and (b==0):
        z+=1
    else:
        if d.get(b/a)==None:
            d[b/a]=1
        else:
            d[b/a]+=1
        s|={b/a}
ans*=2**x+2**y-1
for i in s:
    if d.get(-1/i)!=None:
        j=d[-1/i]
        ans*=2**d[i]+2**j-1
        d[i]=0
        d[-1/i]=0
    else:
        ans*=2**d[i]
        d[i]=0
    if ans>N:
        ans%=N
print(ans+z-1)