MODC = 1000000007

n = gets.strip.to_i
z = 0
st = Hash.new{|hash, key| hash[key] = [0,0]}
n.times do
  a,b = gets.strip.split.map(&:to_i)
  if b == 0
    if a == 0
      z += 1
    else
      st[0][1] += 1
    end
  else
    rr = Rational(a,b)
    if rr >= 0 then st[rr][0] += 1
    else st[-1/rr][1] += 1
    end
  end
end
ans = 1
st.each do |key, val|
  ans *= 2.pow(val[0], MODC) + 2.pow(val[1], MODC) - 1
  ans %= MODC
end
ans += z - 1
ans %= MODC
p ans