<?php

const MOD = 1000000007;
fscanf(STDIN, "%d", $N);
bcscale(20);
$p_count = 0;
$n_count = 0;
$z_count = 0;
$ans = 1;
$ans_list = [];
$zero_count = 0;
$a_zero = 0;
$b_zero = 0;
for($i=1;$i<=$N;$i++){
    $ans *= 2;
    $ans %= MOD;
    $ans_list[$i] = $ans-1;
    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 {
        $div = bcdiv($a, $b);
        if ($div > 0) {
            $p_list[$div][] = $i;
            $p_count++;
        } elseif ($div < 0) {
            $n_list[bcdiv(-$b, $a)][] = $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_list[$p] + $ans_list[$n] + 1) %MOD;
            $diff -= ($p + $n);
        }
    }

    $diff-=$zero_count;

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