mod = 10**9+7
n = gets.to_s.to_i

a = []
b = []
c = []
genten_iwashi = 0

n.times do 
  x, y = gets.to_s.split.map{|e|e.to_i}
  
  if x == 0 && y == 0
    genten_iwashi += 1
    next
  end
  
  g = x.gcd(y)
  if y < 0
    x *= -1
    y *= -1
  end
  a << x.abs / g
  b << y.abs / g
  if x== 0 || y == 0
    c << 0
  else
    c << x / x.abs * y / y.abs
  end
end

# A_{i} / B_{i} = -B_{j} / A_{j}
# L_{i} = R{i}
left  = n.times.map{|i| [ a[i], b[i],  c[i]] }.tally
right = n.times.map{|i| [ b[i], a[i], -c[i]] }.tally

left.default = 0
right.default = 0

class Array
  def musubu
    [self[1], self[0], -self[2]]
  end
end

ans = 2.pow(n, mod) - 1

cnt = []

used = Hash.new(false)

normal = nakayoi = a.size
ans = 2.pow(normal, mod)
left.keys.each do |d|
  
  t = left[d] * right[d]
  if (t > 0 && !used[d] && !used[d.musubu])
    tmp = 2.pow(left[d], mod) + 2.pow(right[d], mod) - 1
    cnt << tmp
    a = left[d]
    b = right[d]
    nakayoi -= a + b
    
  end
  used[d] = used[d.musubu] = true
end

ans = cnt.reduce(2.pow(nakayoi,mod)){|s, t| s * t }

puts ans +  genten_iwashi - 1