N = gets.to_i
ABs = readlines.map{_1.split.map(&:to_i)}
M = 10**9 + 7

p2 = N.times.inject([1]){|r, _| r << r.last*2 % M}
ans, h = 0, Hash.new{|h, k| h[k] = [0, 0]}
ABs.each do |a, b|
  if b == 0
    a == 0 ? ans += 1 : h[(0/1r)][1] += 1
  else
    a*b > 0 ? h[Rational(a, b)][0] += 1 : h[Rational(-b, a)][1] += 1
  end
end
ans += h.values.inject(1){|r, (x, y)| r * (p2[x] + p2[y] - 1) % M} - 1
puts ans