#nowarn "25"

open System
open System.Collections.Generic

let MOD = 1000000007L

let rec gcd (x : int64) (y : int64) =
    if y = 0L then
        x
    else
        gcd y (x % y)

let rec pow2 k =
    if k = 0L then
        1L
    else if k % 2L = 0L then
        let p = pow2 (k / 2L)
        p * p % MOD
    else
        let p = pow2 (k / 2L)
        2L * p * p % MOD


let n = stdin.ReadLine() |> int
let d = new Dictionary<int64 * int64, int64 * int64>()

let mutable zeros = 0

let inc0 (dict : IDictionary<'a, int64 * int64>) k =
    let mutable v = ref (0L, 0L)
    if dict.TryGetValue(k, v) then
        dict.[k] <- (fst !v + 1L, snd !v)
    else
        dict.[k] <- (1L, 0L)

let inc1 (dict : IDictionary<'a, int64 * int64>) k =
    let mutable v = ref (0L, 0L)
    if dict.TryGetValue(k, v) then
        dict.[k] <- (fst !v, snd !v + 1L)
    else
        dict.[k] <- (0L, 1L)
 

for i in 1 .. n do 
    let [| a; b |] = stdin.ReadLine().Split() |> Array.map int64
    
    if a = 0L && b = 0L then
        zeros <- zeros + 1
    else
        let g = gcd (Math.Abs a) (Math.Abs b)

        if b = 0L then
            inc0 d (1L, 0L)
        else if a = 0L then
            inc1 d (1L, 0L)
        else 
            let mutable x = a / g
            let mutable y = b / g

            if x < 0L then
                x <- -x
                y <- -y
            
            if y > 0L then
                inc0 d (x, y)
            else
                inc1 d (-y, x)


let mutable comb = 1L

for kv in d do
    let (pos, neg) = kv.Value
    let c = pow2 pos + pow2 neg - 1L
    comb <- comb * c % MOD

if zeros > 0 then
    printfn "%d" comb
else
    printfn "%d" (comb - 1L)
    