macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        v: [(i128, i128); n]
    }
    let d = 1000000007;
    let mut w: Vec<_> = v.iter().cloned().filter(|x| x.0 != 0 || x.1 != 0).map(|x| if x.0 == 0 && x.1 < 0 || x.0 < 0 {(-x.0, -x.1)} else {x}).collect();
    let ans = n - w.len();
    let n = w.len();
    w.sort_by(|x, y| (x.1 as f64).atan2(x.0 as f64).partial_cmp(&(y.1 as f64).atan2(y.0 as f64)).unwrap());
    let mut l = 0;
    while l < n && w[l].1 <= 0 {
        l += 1;
    }
    if l == n {
        println!("{}", (ans + pow_m(2, n, d) - 1) % d);
        return;
    }
    let l0 = l;
    let mut t = 1;
    let mut c = 1;
    let mut i = 1;
    while i < l0 {
        if w[i - 1].0 * w[i].1 == w[i].0 * w[i - 1].1 {
            i += 1;
            c += 1;
        } else {
            while l < n && w[i - 1].0 * w[l].0 + w[i - 1].1 * w[l].1 > 0 {
                l += 1;
                t = t * 2 % d;
            }
            if l == n {
                t = t * pow_m(2, l0 - i + c, d) % d;
                println!("{}", (ans + t - 1) % d);
                return;
            }
            if w[i - 1].0 * w[l].0 + w[i - 1].1 * w[l].1 < 0 {
                t = t * pow_m(2, c, d) % d;
            } else {
                let mut r = l + 1;
                while r < n && w[i - 1].0 * w[r].0 + w[i - 1].1 * w[r].1 == 0 {
                    r += 1;
                }
                t = t * (pow_m(2, c, d) + pow_m(2, r - l, d) - 1) % d;
                l = r;
            }
            i += 1;
            c = 1;
        }
    }
    while l < n && w[i - 1].0 * w[l].0 + w[i - 1].1 * w[l].1 > 0 {
        l += 1;
        t = t * 2 % d;
    }
    if l == n {
        t = t * pow_m(2, c, d) % d;
        println!("{}", (ans + t - 1) % d);
        return;
    }
    if w[i - 1].0 * w[l].0 + w[i - 1].1 * w[l].1 < 0 {
        t = t * pow_m(2, c, d) % d;
    } else {
        let mut r = l + 1;
        while r < n && w[i - 1].0 * w[r].0 + w[i - 1].1 * w[r].1 == 0 {
            r += 1;
        }
        t = t * (pow_m(2, c, d) + pow_m(2, r - l, d) - 1) % d;
        l = r;
    }
    t = t * pow_m(2, n - l, d) % d;
    println!("{}", (ans + t - 1) % d);
}

fn pow_m(n: usize, mut p: usize, d: usize) -> usize {
    let mut r = n;
    let mut ret = 1;
    while p > 0 {
        if p % 2 == 0 {
            r = r * r % d;
            p /= 2;
        } else {
            ret = ret * r % d;
            p -= 1;
        }
    }
    ret
}
