from collections import defaultdict
import math
mod=1000000007
n=int(input())
dic=defaultdict(int)
x=[]
zerozero,azero,bzero=0,0,0
two=[1]

for i in range(n):
    two.append(two[-1]*2%mod)

for _ in range(n):
        
    a,b=map(int,input().split())
    if a==0 and b==0: zerozero+=1
    elif a==0: azero+=1
    elif b==0: bzero+=1
    else:
        k=math.gcd(a,b)
        a//=k;b//=k
        if a<0: a*=-1;b*=-1
        dic[(a,b)]+=1
        if a*b>0: dic[(b,-a)]+=0
        else: dic[(-b,a)]+=0

for (a,b) in dic:
    if a*b>0:
        x.append([ dic[(a,b)], dic[(b,-a)] ])
x.append([azero,bzero])
ans=1
for [p,q] in x:
    ans*=(two[p]+two[q]-1)
    ans%=mod
print(ans+zerozero-1)