from math import gcd
from collections import defaultdict

n=int(input())
abd=defaultdict(int)
mod=10**9+7
wzero=0
azero=0
bzero=0
for i in range(n):
    a,b=map(int,input().split())
    if a==0 and b==0:
        wzero+=1
    elif a==0 and b!=0:
        azero+=1
    elif a!=0 and b==0:
        bzero+=1
    else:
        x=gcd(a,b)
        a//=x
        b//=x
        abd[(a,b)]+=1

used=[]
liskey=list(abd.keys())
ans=1
for k in liskey:
    if abd[k] != 0:
        x=abd[k]
        used.append(k)
        a,b=k
        y=abd[(-b,a)]+abd[(b,-a)]
        abd[(-b,a)]=0
        abd[(b,-a)]=0
        ans*=(2**x+2**y-1+mod)%mod
        ans%=mod

ans*=(2**azero+2**bzero-1+mod)%mod
ans%=mod
ans+=wzero
ans=(ans+mod-1)%mod
print(ans)