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

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

ans=1
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 h.key? n
    ans *= pow(2,v) + pow(2,h[n]) - 1 + M
  else
    ans *= pow(2,v)
  end
  ans %= M
  used[n]=true
end
p (zer + ans - 1 + M) % M
