class Integer def mod_inverse(mod) self.pow(mod - 2, mod) end end T = gets.to_i MOD = 10 ** 9 + 7 T.times do n = gets.to_i a = gets.split.map(&:to_i) ans = 1 a.each do |x| ans *= (x + 1) end puts (ans - 1) % MOD end