import math._
import collection.mutable.{Map => MTMap}

object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt
  val c = Vector.fill(n)((sc.nextLong, sc.nextLong))

  val mod = 1000000007

  def plus(a: Long, b: Long): Long = (a + b) % mod
  def minus(a: Long, b: Long): Long = (a - b + mod) % mod
  def times(a: Long, b: Long): Long = (a * b) % mod

  def pow(a: Long, n: Long, res: Long = 1): Long = {
    if (n == 0) {
      res
    } else if ((n&1) == 0) {
      pow(times(a,a), n >> 1, res)
    } else {
      pow(times(a,a), n >> 1, times(a,res))
    }
  }

  def gcd(a: Long, b: Long): Long = {
    if (b == 0) a else gcd(b, a % b)
  }

  val m = MTMap[(Long,Long), Long]()
  var z = 0

  for ((a,b) <- c) {
    if (a == 0 && b == 0) {
      z += 1
    } else {
      val d = gcd(a.abs, b.abs)
      if (b == 0) {
        m((1, 0)) = m.getOrElse((1, 0), 0L) + 1
      } else if (b > 0) {
        m((a / d, b / d)) = m.getOrElse((a / d, b / d), 0L) + 1
      } else {
        m((-a / d, -b / d)) = m.getOrElse((-a / d, -b / d), 0L) + 1
      }
    }
  }

  val bads = m.collect{
    case ((a, b), l) if a > 0 && m.isDefinedAt((-b, a)) => (l, m((-b, a)))
  }

  val ans = minus(plus(times(
    pow(2, n - z - bads.map{case (x,y) => x+y}.sum),
    bads.map{case (x,y) => minus(plus(pow(2,x), pow(2,y)), 1)}.foldLeft(1L)(times(_,_))
  ), z), 1)

  println(ans)
}
