fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() } fn main() { let t: usize = read(); for _ in 0..t { let n: usize = read(); let a: Vec = read_vec(); let mut ans = 1; for i in 0..n { ans *= (a[i] + 1); ans %= 1_000_000_007; } if ans == 0 { ans = 1_000_000_007 - 1; } else { ans -= 1; } println!("{}", ans); } }