N = gets.to_i
AB = []
N.times do
    AB << gets.split.map(&:to_i)
end

# Ai / Bi = - Bj / Aj (Bi != 0 && Aj != 0)
# Bi != 0 || Aj != 0 のときも +Inf = 0 を仮定すれば成立（実数で表さなきゃいい）

h = Hash.new(0)

zero_count = 0

AB.each do |a, b|
    if a == 0 && b == 0
        zero_count += 1
        next
    end
    key = b > 0 ? [a, b] : [-a, -b]
    key.map!{|x| x / a.gcd(b)}
    h[key] += 1
end

ans = 1

h.each do |(a, b), count|
    key2 = -a > 0 ? [b, -a] : [-b, a]
    count2 = h[key2]
    h.delete(key2)
    h.delete([a, b])
    
    ans *= ((2 ** count - 1) + (2 ** count2 - 1) + 1)
    ans %= 1000000007
end

puts ans + zero_count - 1