import java.util.Scanner

fun main() {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	var azs = 0
	var bzs = 0
	var zzs = 0
	val ps = mutableMapOf<Double, Int>()
	val ns = mutableMapOf<Double, Int>()
	repeat(n){
		val a = scn.nextLong()
		val b = scn.nextLong()
		val div = b.toDouble()/a
		if (a==0L && b==0L) zzs++
		else if (a==0L) azs++
		else if (b==0L) bzs++
		else if ((a>0) == (b>0)) ps[div] = ps.getOrElse(div){0} + 1
		else ns[div] = ns.getOrElse(div){0} + 1
	}
	var ans = ModInt.pow(2, azs) + ModInt.pow(2, bzs) - 1
	val pks = ps.keys.sortedDescending()
	val nks = ns.keys.sortedDescending()
	var pi = 0
	var ni = 0
	var pflg = false
	var nflg = false
	while (pi<ps.size && ni<ns.size){
		val v = pks[pi]*nks[ni] + 1
		if (v>0) {
			if (!nflg) ans *= ModInt.pow(2, ns[nks[ni]]!!)
			ni++
			nflg = false
		} else if (v<0){
			if (!pflg) ans *= ModInt.pow(2, ps[pks[pi]]!!)
			pi++
			pflg = false
		}
		else {
			ans *= ModInt.pow(2,ps[pks[pi]]!!) + ModInt.pow(2, ns[nks[ni]]!!) - 1
			if (pi==pks.lastIndex) {
				ni++
				pflg = true
			} else{
				pi++
				nflg = true
			}
		}
	}
	while (pi<ps.size){
		if (!pflg) ans *= ModInt.pow(2, ps[pks[pi]]!!)
		pi++
		pflg = false
	}
	while (ni<ns.size){
		if (!nflg) ans *= ModInt.pow(2, ns[nks[ni]]!!)
		ni++
		nflg = false
	}
	ans--
	ans += zzs
	println(ans)
}

class ModInt {
	var v: Long
		private set
	constructor(v: Int){
		this.v = when {
			v>=0 -> v.toLong() % MOD
			v==Int.MIN_VALUE -> 852516373
			else -> MOD.toLong() - (-v%MOD)
		}
	}
	constructor(v: Long){
		this.v = when {
			v>=0 -> v % MOD
			v==Long.MIN_VALUE -> 708828003
			else -> MOD - (-v%MOD)
		}
	}

	override fun toString() = v.toString()
	fun toInt() = v.toInt()
	fun toLong() = v
	override fun equals(other: Any?): Boolean {
		return if (other is ModInt) v == other.v else false
	}
	override fun hashCode() = 31*17 + v.hashCode()

	operator fun unaryPlus() = this
	operator fun unaryMinus() = ModInt(MOD-this.v)

	private operator fun plus(o: Long) = ModInt(this.v + o)
	operator fun plus(o: ModInt) = this.plus(o.v)
	operator fun plus(o: Int) = this.plus(o.toLong())
	private operator fun minus(o: Long) = this.plus(-o)
	operator fun minus(o: ModInt) = this.minus(o.v)
	operator fun minus(o: Int) = this.minus(o.toLong())
	private operator fun times(o: Long) = ModInt(this.v*o)
	operator fun times(o: ModInt) = this.times(o.v)
	operator fun times(o: Int) = this.times(o.toLong())
	private operator fun div(o: Long) = this.times(pow(o, MOD-2))
	operator fun div(o: ModInt) = this.div(o.v)
	operator fun div(o: Int) = this.div(o.toLong())

	operator fun inc() = this.plus(1)
	operator fun dec() = this.minus(1)

	companion object{
		const val MOD = 1000000007

		private fun pow(b:Long, e: Int): ModInt{
			if (b==1L) return ModInt(1)
			var ans = 1L
			var b = b; var e = e
			while (e!=0){
				if (e%2==1) ans = (ans*b)%MOD
				b = (b*b)%MOD
				e /= 2
			}
			return ModInt(ans)
		}
		fun pow(b: Int, e: Int): ModInt = pow(b.toLong(), e)
		fun pow(b: ModInt, e: Int): ModInt = pow(b.v, e)
	}
}