struct Int

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

require "big"

mod = 1_000_000_007

n = gets.to_s.to_i

h = Hash(BigRational, 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 ? BigRational.new(a,b) : -BigRational.new(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