MODC = 1000000007
def mulm(x,y)
  return (x * y) % MODC
end

def powm(x,y)
  return 0 if y < 0
  t=1
  while y != 0
    t = mulm(t,x) if y & 1 != 0
    x = mulm(x,x)
    y >>= 1
  end
  return t
end

  n = gets.strip.to_i

  z = 0
  s = Hash.new(0)
  t = Hash.new(0)
    n.times do
    a,b = gets.strip.split.map(&:to_i)
    if b == 0
      if a == 0
        z += 1
      else
        t[0] += 1
      end
    else
      rr = Rational(a,b)
      if rr >= 0 then s[rr] += 1
      else t[-1/rr] += 1
      end
    end
  end
  
  ans = 1
  s.each do |key, val|
    tmp = powm(2,val)
    tmp += powm(2,t[key])
    tmp += MODC - 1
    tmp %= MODC
    t.delete(key)
    ans = mulm(ans, tmp)
  end
  tmp = 0
  t.each do |key, val|
    tmp += val
  end
  ans = mulm(ans, powm(2,tmp))
  ans += z + MODC - 1
  ans %= MODC
  p ans
