N = gets.to_i
M = 1000000007

zeros = 0
counts = {}
N.times do 
    a,b = gets.split.map &:to_i
    if a==0 && b==0 then
        zeros += 1
    else
        gcd = a.gcd b
        a = a/gcd
        b = b/gcd
        if a<0 then
            a=-a
            b=-b 
        end
        counts[[a,b]] ||= 0
        counts[[a,b]] += 1
    end
end

if counts.empty? then
    p zeros
    exit
end

ans = 1
while counts.any?
    key,c = counts.shift
    comb = ((2**c-1) + 1) % M

    a,b = key
    if b<0 then
        a=-a
        b=-b 
    end
    if c = counts.delete([b,-a]) then
        comb += (2**c-1) % M
    end

    ans = (ans * comb) % M
end

p ans + zeros - 1
