require 'set'

def get_ints
  gets.split.map(&:to_i)
end

def get_int
  gets.chomp.to_i
end

MOD = 1000000007

params = []

N = get_int

premise = Hash.new(0)
additional = 0
result = 1

N.times do
  a, b = get_ints

  if a == 0 && b == 0
    additional += 1
  elsif a == 0
    premise[[0, 1]] += 1
  elsif b == 0
    premise[[1, 0]] += 1
  else
    gcd = a.gcd(b)
    a /= gcd
    b /= gcd

    if a < 0
      a *= -1
      b *= -1
    end

    premise[[a, b]] += 1
  end
end

premise.each do |(a, b), count|
  pair = b < 0 ? [-b, a] : [b, -a]
  pair_count = premise[pair]
  premise.delete(pair)

  result *= (2 ** count - 1) + (2 ** pair_count - 1) + 1
  result %= MOD
end

puts (result + additional - 1) % MOD
