n=int(input())

mod=10**9+7

#初期値が0の辞書
from collections import defaultdict
pp = defaultdict(lambda: 0) 
pm = defaultdict(lambda: 0) 

from math import gcd
zero=0
for _ in range(n):
    a,b=map(int,input().split())

    if a==0 and b==0:
        zero+=1
    elif a*b>0:
        tmp=gcd(a,b)
        a=a//tmp
        b=b//tmp
        pp[(a,b)]+=1
    elif a==0:
        pp[(1,0)]+=1
    elif n==0:
        pm[(0,1)]+=1
    else:
        tmp=gcd(abs(a),abs(b))
        a=abs(a//tmp)
        b=abs(b//tmp)
        pm[(b,a)]+=1
            
            
result=1
for key in pp.keys():
    pp_v=pp[key]
    pm_v=pm[key]
    result*=(pow(2,pm_v,mod)+pow(2,pp_v,mod)-1)
    result%=mod

print((result-1+zero)%mod)


    

    