n = gets.chomp.to_i
a = []
b = []
n.times do
 aa, bb = gets.chomp.split.map(&:to_i)
 a.push(aa)
 b.push(bb)
end

MOD = 1000000007

t = []
u = []

n.times do |i|
  t.push(a[i] == 0 ? 0 : b[i].to_f/a[i])
  u.push(b[i] == 0 ? 0 : a[i].to_f/b[i])
end

hash = t.group_by(&:itself).map{ |key, value| [key, value.count] }.to_h

ans = 0
n.times do |i|
  no = hash[-u[i]] || 0
  ans += 2.pow(n-no-1, MOD)
end
p ans % MOD
