n = gets.chomp.to_i
a = []
b = []
n.times do
 aa, bb = gets.chomp.split.map(&:to_i)
 a.push(aa)
 b.push(bb)
end

MOD = 1000000007

zero = 0
t = {}

n.times do |i|
  aa, bb = a[i], b[i]
  if aa == 0 && bb == 0
    zero += 1
    next
  end

  gc = aa.gcd(bb)
  aa /= gc
  bb /= gc
  if aa < 0
    aa *= (-1)
    bb *= (-1)
  end
  if t[[aa,bb]].nil?
    t[[aa,bb]] = 1
  else
    t[[aa,bb]] += 1
  end
end

ans = 1
t.each do |ar, num|
  aa, bb = ar
  if bb < 0
    aa *= (-1)
    bb *= (-1)
  end
  u = t[[bb, -aa]] || 0
  t.delete([bb, -aa])
  tmp = 2 ** num - 1 + 2 ** u - 1 + 1
  ans *= tmp
  ans %= MOD
end

p (ans + zero - 1) % MOD
