struct Int

  # O(log n)
  def pow(n : Int, mod = nil ) : Int
    a = to_i64
    res = 1_i64
    while n > 0
      if (n & 1) != 0
        res *= a
        res %= mod if mod
      end
      a *= a
      a %= mod if mod
      n >>= 1
    end
    res
  end
end

def r(a,b)
  a = a.abs
  b = b.abs
  g = a.gcd(b)
  { a / g, b / g }
end

require "big"

mod = 1_000_000_007

n = gets.to_s.to_i

h = Hash(Tuple(Int64, Int64), Array(Int32)).new{|h, k| h[k] = [0_i32, 0_i32] }
genten_iwashi = 0_i64

n.times do
  a, b = gets.to_s.split.map{|t|t.to_i64}

  if 0 == a && 0 == b
    genten_iwashi += 1_i64
  else
    f = a.zero? || (a>0 && b>0)  || (a<0 && b<0) 
    r = ( f ? r(a,b) : r(b,a) )
    h[r][ f ? 0 : 1 ] += 1
  end
end

ans = 1_i64
h.values.each do |(a, b)|
  ans = (ans * (( 2_i64.pow(a,mod) + 2_i64.pow(b, mod) - 1_i64) % mod) ) % mod
end

ans = ( ans - 1 + genten_iwashi ) % mod

puts ans