<?php

const MOD = 1000000007;
bcscale(36);

fscanf(STDIN, "%d", $N);
$p_count = 0;
$n_count = 0;
$ans = 1;
$ans_list = [];
$ans_list[0] = 0;
$p_list =[];
$n_list= [];
$zero_count = 0;
$a_zero = 0;
$b_zero = 0;
for($i=1;$i<=$N;$i++){
    $ans *= 2;
    $ans_list[$i] = ($ans - 1) %MOD;

    $ans %= MOD;

    fscanf(STDIN, "%d%d", $a, $b);
    $map[$i] = [$a, $b];
    if($a == 0 && $b == 0){
        $zero_count++;
    }elseif($a == 0){

        $p_list[0][] = $i;
        $p_count++;

    }elseif($b == 0){

        $n_list[0][] = $i;
        $n_count++;
    }else {

        if (($a > 0 && $b > 0) || $a < 0 && $b < 0) {
            $div = md5(bcdiv($b, $a));

            $p_list[$div][] = $i;
            $p_count++;
        } else{
            $n_list[md5(bcdiv(abs($a), abs($b)))][] = $i;
            $n_count++;
        }
    }
}
$diff = $N;
$ans = 1;
    foreach($p_list as $key => $value){
        if(isset($n_list[$key])){
            $p = count($p_list[$key]);
            $n = count($n_list[$key]);
            $ans = $ans * (($ans_list[$p] + $ans_list[$n] + 1) %MOD) % MOD;
            $diff -= ($p + $n);
        }
    }

    $diff-=$zero_count;

echo ($ans * (($ans_list[$diff]+1) %MOD)  -1 + $zero_count) %MOD;