
import kotlin.math.abs


fun gcd(a:Long, b:Long): Long {
    if(b==0L)
        return a
    return gcd(b, a % b)
}

fun main() {
    val n = readLine()!!.toInt()
    val m = Array(2){HashMap<Pair<Long,Long>, Int>()}
    val t = LongArray(n+1)
    val mod = (1e9+7).toLong()
    var zero = 0L

    t[0] = 1L
    for(i in 1..n) {
        t[i] = (t[i-1] * 2L) % mod
    }

    for(i in 1..n) {
        var (a,b) = readLine()!!.split(" ").map { it.toLong() }
        if(a==0L && b==0L) {
            ++zero
            continue
        }
        if(a == 0L || b == 0L) {
            if(a==0L) {
                b = 1L
                // a: 0  b : 1
                m[0][a to b] = (m[0][a to b]?:0) + 1
            } else {
                a = 1L
                // a : 1 b : 0
                m[1][a to b] = (m[1][a to b]?:0) + 1
            }
            continue
        }
        val g = gcd(a,b)
        if( g != 0L) {
            a /= g
            b /= g
        }
        val idx = if((a <= 0 && b <= 0) || (a>=0 && b>=0)) 0 else 1
        val p = abs(a) to abs(b)
        m[idx][p] = (m[idx][p]?:0) + 1
    }
    val list = ArrayList<Long>()

    for((k,v) in m[0]) {
        val r = k.second to k.first
        var c = t[v]
        if(m[1].contains(r)) {
            c = (c + t[m[1][r]!!] -1L + mod) % mod
            m[1].remove(r)
        }
        list.add(c)
    }

    for((_,v) in m[1]) {
        list.add(t[v])
    }

    var ans = 1L
    for(v in list) {
        ans *= v
        ans %= mod
    }
    ans = (ans + mod - 1L + zero) % mod
    print(ans)
}