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
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|
  tmp = powm(2,val[0])
  tmp += powm(2,val[1])
  tmp += MODC - 1
  tmp %= MODC
  ans = mulm(ans, tmp)
end
ans += z + MODC - 1
ans %= MODC
p ans
