#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use grapth::*;
use math::*;
use string_algorithm::*;
use util::*;
use input_scanner::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let n: usize = scan.next();
    let mut zero = 0u64;
    let mut a0 = 0u64;
    let mut b0 = 0u64;
    let mut h: HashMap<(i64,i64), u64> = HashMap::new();
    for _ in 0..n {
        let mut a: i64 = scan.next();
        let mut b: i64 = scan.next();
        if b < 0 {
            a = -a;
            b = -b;
        }

        if a == 0 && b==0 {
            zero += 1;
        }else if a==0 {
            a0 += 1;
        }else if b==0 {
            b0 += 1;
        }else{
            let g: i64 = gcd(a.abs() as u64, b.abs() as u64) as i64;
            let e1 = h.entry((a/g,b/g)).or_insert(0);
            *e1 += 1;
        }
    }
    const MOD: u64 = 1_000_000_007;
    let mut ans: u64 = 1;
    for p in &h {
        let p1 = p.0;
        if p1.0 < 0 {
            continue;
        }
        let p2 = (-p1.1, p1.0);
        let c1 = p.1;
        if let Some(v) = h.get(&p2) {
            let c2 = v;
            ans *= pow_mod(2, *c1, MOD)  - 1 + pow_mod(2, *c2, MOD);
            ans %= MOD;
        }
    }
    for p in &h {
        let p1 = p.0;
        let c1 = p.1;
        if None == h.get(&(p1.1, -p1.0)) && None == h.get(&(-p1.1, p1.0)) {
            ans *= pow_mod(2, *c1, MOD);
            ans %= MOD;
        }
    }
    ans *= (pow_mod(2, a0, MOD) - 1) + pow_mod(2, b0, MOD);
    ans += zero;
    ans %= MOD;
    println!("{}", if ans > 0 {ans -1} else {MOD-1});
}

mod datastructure {}
mod grapth {}
mod math {
    pub fn pow_mod(mut x: u64, mut y: u64, modv: u64) -> u64 {
        let mut ret: u64 = 1;
        while y > 0 {
            if (y & 1) != 0 {
                ret = ret * x % modv;
            }
            y >>= 1;
            x = x * x % modv;
        }
        ret
    }
    pub fn gcd(a: u64, b: u64) -> u64 {
        if b == 0 {
            a
        } else {
            gcd(b, a % b)
        }
    }    
}
mod string_algorithm {}
mod util {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }
    
    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str = unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


Measured memory_bytes: 19308