import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); long ans = 1; for (int j = 0; j < n; j++) { ans *= sc.nextInt() + 1; ans %= MOD; } ans--; ans += MOD; ans %= MOD; sb.append(ans).append("\n"); } System.out.print(sb); } }