#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 pow b k =
    let mutable r = 1L
    for i in 1L .. k do
        r <- r * b % MOD
    r

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)
 
let n = stdin.ReadLine() |> int
let d = new Dictionary<int64 * int64, int64 * int64>()
let mutable zeros = 0L

for i in 1 .. n do 
    let [| a; b |] = stdin.ReadLine().Split() |> Array.map int64
    
    if a = 0L && b = 0L then
        zeros <- zeros + 1L
    else if b = 0L then
        inc0 d (1L, 0L)
    else if a = 0L then
        inc1 d (1L, 0L)
    else 
        let g = gcd (Math.Abs a) (Math.Abs b)
        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 = (pow 2L pos + pow 2L neg - 1L + MOD) % MOD
    printfn "%A %d" kv c
    comb <- comb * c % MOD

printfn "%d" ((zeros + comb - 1L + MOD) % MOD)
    