MOD = 1000000007
n = gets.to_i
d = Hash.new {|h,k| h[k] = [0, 0] }
z = 0

n.times do
  a, b = gets.split.map(&:to_i)
  if a == 0 and b == 0
    z += 1
  elsif a == 0
    d[[1, 0]][0] += 1
  elsif b == 0
    d[[1, 0]][1] += 1
  else
    g = a.abs.gcd(b.abs)
    x = a / g
    y = b / g
    
    if x < 0
      x, y = -x, -y
    end

    if y < 0
      d[[-y, x]][1] += 1
    else
      d[[x, y]][0] += 1
    end
  end  
end

comb = 1

d.each do |k, v|
  a, b = *v
  comb *= (2 ** a + 2 ** b - 1) % MOD
end

p (comb + z - 1)