#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
import random
import math
from collections import  Counter
def resolve():
    MOD=1000000007
    N,=pin()
    #think of Ai*Bi+Aj*Bj=0 "<=" Ai/Bi=0-Bj/Aj　逆は成り立たないのでコーナーケースが出ますね？
    #わかるArctanしたいが考えるな　
    vec=dict()
    ori=0
    for i in range(N):
        a,b=pin()
        if b==0:
            if a==0:
                ori+=1
            else:#正負関係なしINF
                vec.setdefault("INF",0)
                vec["INF"]+=1
        else:
            f=a/b
            vec.setdefault(f,0)
            vec[f]+=1
    n=len(vec)
    #print(vec,n)    
    reg=0    
    banpair=[]
    seen=set()

    for k,v in vec.items():
        if k in seen:
            continue

            
        if k=="INF":#0のペア
            if 0 in vec:
                banpair.append((v,vec[0]))
                seen.add(0)
                continue
                
        elif k==0:
            if "INF" in vec:
                banpair.append((v,vec["INF"]))
                seen.add("INF")
                continue
                
        else:
            t=(-1)/k
            if t in vec:
                banpair.append((v,vec[t]))
                seen.add(t)
                continue
        #print(k,v,"reg")
        reg+=v

    #print(banpair)
    lenb=len(banpair)
    stack=[(0,1)]
    bans=1 
    for b in banpair:
        p=pow(2,b[0],MOD)-1
        q=pow(2,b[1],MOD)-1
        bans=bans*(p+q+1)%MOD
#    print(bans)
    """
    while(stack!=[]):
        p,q=stack.pop()
        if p==lenb:
            q2=q%MOD
            bans+=q2
            bans%=MOD
            continue
        for i in range(2):
            stack.append((p+1,q*(2**banpair[p][i]-1)%MOD))
        stack.append((p+1,q*1))
    """
    #print(bans,reg)
    #print(N-reg-bans)
    ans1=pow(2,reg,MOD)*(bans)-1
    ans2=(ori)#ori同士も内積のルールに引っかかる
    print((ans1+ans2)%MOD)   
#%%submit!
resolve()