macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::{HashMap, HashSet};

const MOD: u64 = 1000000007;
const ZERO: (bool, u64, u64) = (false, 0, 0);

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn make(a: i64, b: i64) -> (bool, u64, u64) {
    if a == 0 && b == 0 {
        ZERO
    } else if a == 0 {
        (false, 1, 0)
    } else if b == 0 {
        (true, 0, 1)
    } else {
        let s = if a < 0 || b < 0 { true } else { false };
        let a = a.abs() as u64;
        let b = b.abs() as u64;
        let g = gcd(a, b);
        let aa = a / g;
        let bb = b / g;
        (s, aa, bb)
    }
}

fn flip(p: (bool, u64, u64)) -> (bool, u64, u64) {
    (!p.0, p.2, p.1)
}

fn mod_pow(mut base: u64, mut exp: u64) -> u64 {
    let mut result = 1;
    base = base % MOD;
    while exp > 0 {
        if exp % 2 == 1 {
            result = result * base % MOD;
        }
        exp = exp >> 1;
        base = base * base % MOD
    }
    result
}

fn main() {
    input! {
        n: usize,
        ab : [(i64, i64); n],
    };

    let mut m1 = HashMap::new();
    for (a, b) in ab {
        let p = make(a, b);
        *m1.entry(p).or_insert(0) += 1;
    }
    let zero = *m1.get(&ZERO).unwrap_or(&0);
    let mut ans = 1;
    let mut used = HashSet::new();
    for (&p1, &c1) in m1.iter() {
        if p1 == ZERO {
            continue;
        }
        if used.contains(&p1) {
            continue;
        }
        let p2 = flip(p1);
        used.insert(p2);
        let c2 = *m1.get(&p2).unwrap_or(&0);
        // println!("{:?} {} {:?} {}", p1, c1, p2, c2);
        // println!("{} {}", mod_pow(2, c1), mod_pow(2, c2));
        ans = ans * (mod_pow(2, c1) + mod_pow(2, c2) - 1) % MOD;
    }
    println!("{}", (ans + mod_pow(2, zero) - 1 + MOD - 1) % MOD);
}
