from fractions import Fraction
n=int(input())

zero=0
plus=[]
minus=[]

for i in range(n):
    a,b=map(int,input().split())
    if(a*b>0):
        plus.append(Fraction(a,b))
    elif(a*b<0):
        minus.append(Fraction(-b,a))
    else:
        if(a==0 and b==0):
            zero+=1
        elif(a==0):
            plus.append(Fraction(0,1))
        else:
            minus.append(Fraction(0,1))

plus.sort()
minus.sort()

kazu=n-zero

pl=len(plus)
ml=len(minus)
#print(kazu)
#print(plus)
#print(minus)

#kyoutu=list(set(plus) & set(minus))
#kyoutu.sort()

kyoutu=[]

gen=0
start=0
for i in range(pl):
    start=gen
    for j in range(start,ml):
        if(plus[i]==minus[j]):
            kyoutu.append(plus[i])
        elif(plus[i]<minus[j]):
            break
        gen+=1

kyoutu=list(set(kyoutu))
kyoutu.sort()
#print(kyoutu)

tyohuku=[[0,0]for i in range(len(kyoutu))]

gen=0
start=0
for i in range(len(kyoutu)):
    #print("check",kyoutu[i],start)
    gen=start
    for j in range(gen,pl):
        #print(plus[j])
        
        if(plus[j]==kyoutu[i]):
            tyohuku[i][0]+=1
        elif(plus[j]>kyoutu[i]):
            break
        start+=1

gen=0
start=0
for i in range(len(kyoutu)):
    #print("check",kyoutu[i],start)
    gen=start
    for j in range(gen,ml):
        #print(minus[j])
        
        if(minus[j]==kyoutu[i]):
            tyohuku[i][1]+=1
        elif(minus[j]>kyoutu[i]):
            break
        start+=1

#print(tyohuku)

oks=[0]*len(kyoutu)

ruijo=[]

sosu=1000000007
temp=1
for i in range(n+1):
    ruijo.append(temp)
    temp*=2
    temp%=sosu

#print(ruijo)

nokori=kazu

for i in range(len(kyoutu)):
    nokori-=tyohuku[i][0]+tyohuku[i][1]
    oks[i]=ruijo[tyohuku[i][0]]+ruijo[tyohuku[i][1]]-1
    oks[i]%=sosu

ans=ruijo[nokori]

for o in oks:
    ans*=o
    ans%=sosu

ans-=1
ans+=zero
ans%=sosu
print(ans)