n=gets.to_i
ab=(0...n).map{gets.split.map{|s| s.to_i }}
M=1000000007
tmp={}
ab.each{|a,b|
    r = a.abs == b.abs ? Rational(a.abs,b.abs) : a.abs < b.abs ?  Rational(a,b) : -Rational(b,a)
    tmp[r]||=[0,0]
    tmp[r][((a<0) == (b<0) ? 0:1)]+=1
}

v = 1
tmp.each{|k,(a,b)|
    p [k,a,b]
    v *= (2**a + 2**b - 1)
    v %= M
}

p v-1
