import math

def divide(a,b):
    minus=0
    if a*b<0:
        minus=1
    t=math.gcd(a,b)
    ret=str(abs(a)//t)+'/'+str(abs(b)//t)
    if minus==1:
        ret="-"+ret
    return ret

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:
        p=divide(b,a)
        if d.get(p)==None:
            d[p]=1
        else:
            d[p]+=1
        s|={p}
if x==0:
    ans*=2**y
elif y==0:
    ans*=2**x
else:
    ans*=2**x+2**y-1

for i in s:
    if i.startswith("-"):
        index=i.index('/')
        q=i[index+1:]+'/'+i[1:index]
    else:
        index=i.index('/')
        q='-'+i[index+1:]+'/'+i[:index]
    if d.get(q)!=None:
        j=d[q]
        ans*=2**d[i]+2**j-1
        d[i]=0
        d[q]=0
    else:
        ans*=2**d[i]
        d[i]=0
    if ans>N:
        ans%=N
print(ans+z-1)