M=1000000007

def pow(n,m)
  return 1 if m.zero?
  m.odd? ? (n*pow(n,m-1)%M) : pow(n*n%M,m/2)
end

h=Hash.new{|h,k|h[k]=0}
gets.to_i.times.map{gets.split.map(&:to_i)}.map{|a,b|
  d=(a.zero? && b.zero?) ? 1 : a.abs.gcd(b.abs)
  [a/d, b/d]
}.map{|a,b| b<0 ? [-a,-b] : [a,b]}.each do |a,b|
  h[[a,b]]+=1
end

ans=1
zer=0
used={}
h.each do |(a,b),v|
  next if used[[a,b]]
  n=[-b,a]
  n=[-n[0],-n[1]] if n[1]<0
  if n.all?{|i|i.zero?}
    zer = v
  elsif h.key? n
    ans *= pow(2,v) + pow(2,h[n]) - 1
  else
    ans *= pow(2,v)
  end
  ans %= M
  used[n]=true
end
p (zer + ans - 1 + M) % M
