package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	for a%b != 0 {
		a, b = b, a%b
	}
	return b
}

func cut(a, b int) (int, int) {
	if a*b == 0 {
		return a, b
	}
	g := gcd(abs(a), abs(b))
	return a / g, b / g
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	const mod = 1000000007

	n := nextInt()
	a, b := make([]int, n), make([]int, n)
	mm := map[int]map[int]int{}
	for i := 0; i < n; i++ {
		a[i], b[i] = nextInt(), nextInt()
		c, d := cut(a[i], b[i])
		if _, ok := mm[d]; ok {
			if _, ok = mm[d][-c]; ok {
				mm[d][-c]++
				continue
			}
		}
		if _, ok := mm[-d]; ok {
			if _, ok = mm[-d][c]; ok {
				mm[-d][c]++
				continue
			}
		}
		mm[c] = map[int]int{}
		mm[c][d]++
	}
	// puts(mm)

	ans := 1
	for _, m := range mm {
		for _, v := range m {
			ans = (ans * (v + 1)) % mod
		}
	}
	puts(ans - 1)
}
