import sys
sys.setrecursionlimit(2147483647)


n=int(input())

mod=10**9+7

#初期値が0の辞書

pp = {} 
pm = {} 

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

    if a*b!=0:
        tmp=gcd(a,b)
        a=a//tmp
        b=b//tmp

        if a*b>0:
            if (a,b) in pp:
                pp[(a,b)]+=1
            else:
                pp[(a,b)]=1
        else:
            aa=abs(a)
            bb=abs(b)
            if (aa,bb) in pm:
                pm[(aa,bb)]+=1
            else:
                pm[(aa,bb)]=1

    elif a==0 and b==0:
        zero+=1
    else:
        if (a,b) in pp:
            pp[(a,b)]+=1
        else:
            pp[(a,b)]=1

            

#print(pp_k,pm_k)
result=1
for key in pp.keys():
    pp_v=pp[key]
    a,b=key[0],key[1]
    if (b,a) in pm:
        pm_v=pm[(b,a)]
        result=result*((pow(2,pp_v,mod)-1)+(pow(2,pm_v,mod)-1)+1)
    else:
        result=result*pow(2,pp_v,mod)

for key in pm.keys():
    pm_v=pm[key]
    a,b=key[0],key[1]
    if (b,a) not in pp:
        result=result*pow(2,pm_v,mod)

print(result-1+zero)


    

    