import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

mod=1000000007
n=int(input())
if n==1:
    print(1)
    exit()
l1=[]
l2=[]
l0=0
for i in range(n):
    a,b=mp()
    if a*b>0:
        l1.append(a/b)
    elif a*b==0:
        l0=1
    else:
        l2.append(-b/a)
c1=sorted(list(Counter(l1).most_common()),key=lambda x: x[0])
c2=sorted(list(Counter(l2).most_common()),key=lambda x: x[0])
c1.append((10**10, 1))
c2.append((10**10, 1))


ans=1
i=0
k=0
while i<len(c1)-1 or k<len(c2)-1:



    if c1[i][0]<c2[k][0]:
        ans*=pow(2,c1[i][1],mod)
        i+=1
    elif c1[i][0]>c2[k][0]:
        ans*=pow(2,c2[k][1],mod)
        k+=1
    else:
        ans*=(pow(2,c1[i][1],mod)+pow(2,c2[k][1],mod)-1)
        i+=1
        k+=1
ans*=pow(2,l0,mod)
print((ans-1)%mod)
