# frozen_string_literal: true

n = gets.to_i
ab = n.times.map { gets.split.map(&:to_i) }
MOD = 1_000_000_007

h = Hash.new { 0 }
done = Hash.new { false }

ab.each do |e|
  a = e[0]
  b = e[1]
  c = []
  if b.zero?
    c = if a.zero?
          [0, 0]
        else
          [-1, 0]
        end
  else
    t = Rational(a, b)
    c = [t.numerator, t.denominator]
  end
  h[c] += 1
end
mul = 1
count = 0
h.each do |k, v|
  if k == [0, 0]
    mul *= 2**v
    mul %= MOD
  else
    kk = if k[0].negative?
           [k[1], -k[0]]
         else
           [-k[1], k[0]]
         end
    if h[kk].positive? && !done[k] && !done[kk]
      mul *= (2**v + 2**h[kk] - 1)
      mul %= MOD
      done[k] = true
      done[kk] = true
    else
      count += 1 if !done[k]
    end
  end
end
puts (mul * 2**count - 1) % MOD
