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()

    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() }
        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
        if(idx == 1 && (a == 0L || b == 0L)) {
            while (true){}
        }
        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) % mod
    print(ans)
}