Mod = 1000000007
N = gets.to_i
zs = 0
X = []
Y = []
(0...N).each{ 
  a,b = gets.split.map &:to_i
  if a == 0 && b == 0
    zs += 1; next
  end

  if b < 0
    a = -a; b = -b;
  end
  if b == 0 && a < 0
    a = -a
  end
  if a > 0
    g = b > 0 ? a.gcd(b) : 1
    X << "#{a/g}_#{b/g}"
  else
    a,b = b,-a
    g = b > 0 ? a.gcd(b) : 1
    Y << "#{a/g}_#{b/g}"
  end
}

#p zs, X, Y

xh = {}
yh = {}
args = {}
X.each{ |arg| args[arg] = 1; xh[arg] = (xh[arg] || 0) + 1 }
Y.each{ |arg| args[arg] = 1; yh[arg] = (yh[arg] || 0) + 1 }

bins = [1]
N.times{ bins << (bins[-1] * 2 % Mod) }

ans = 1
args.keys.each{ |arg|
  x = xh[arg] || 0
  y = yh[arg] || 0
  ans = ans * (bins[x] + bins[y] - 1) % Mod
  #p [arg,x,y,ans]
}
ans = (ans + zs - 1) % Mod
p ans