M=10**9+7
n=gets.to_i
h=Hash.new 0
ans=1
n.times{
  a,b=gets.split.map &:to_i
  g=a.gcd(b)
  r=b==0 ? a==0 ? :nan : :inf : Rational(a,b)
  h[r]+=1
}
ps=[]
h.each{|r,c|
  if r==:nan
  elsif r==:inf
    q=0
    if h[q]==0
      ps<<[h[r],h[q]]
    end
  elsif r==0
    q=:inf
    ps<<[h[r],h[q]]
  else
    q=-1/r
    if r>0||(r<0&&h[q]==0)
      ps<<[h[r],h[q]]
    end
  end
  ans%=M
}
#p h
#p ps
ps.each{|a,b|
  ans*=(2.pow(a,M)+2.pow(b,M)-1)
  ans%=M
}
p (ans+M-1)%M