n=int(input())
from math import gcd
from collections import defaultdict
abd=defaultdict(int)
mod=10**9+7
ab=[]
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
        continue
    elif a==0 and b!=0:
        azero+=1
        continue
    elif a!=0 and b==0:
        bzero+=1
        continue
    x=gcd(a,b)
    a//=x
    b//=x
    ab.append((a,b))
    abd[(a,b)]+=1

kumid=defaultdict(int)
for i in range(len(ab)):
    a,b=ab[i]
    cnt=abd[(-b,a)]+abd[(b,-a)]
    kumid[cnt]+=1
maxkey=max(kumid.keys())
ans=1

for i in range(maxkey,1,-1):
    if kumid[i]!=0:
        j=kumid[i]
        kumid[j]-=i
        tmp=2**i+2**j-1
        ans*=(tmp%mod)
        ans%=mod
#print(kumid)
ans*=(kumid[1]+1)
ans%=mod
ans*=2**kumid[0]%mod
ans%=mod
ans*=(2**azero+2**bzero-1)%mod
ans%=mod
ans+=wzero
ans=(ans+mod-1)%mod
print(ans)