Given an array **A[ ]** of **N **sorted positive integers, find the smallest positive integer **S **such that **S **cannot be represented as sum of elements of any subset of the given array set.

**Input**

The first line of input contains an integer **T **denoting the number of test cases. Then **T **test cases

follow.

The first line of each test case contains a positive integer **N**, denoting the length of the array **A[ ]**.

The second line of each test case contains a **N **space separated positive integers, denoting the

elements of the array **A[ ]**.

**Note: **The elements of the array should be sorted in ascending order.

**Output**

Print out the the smallest number **S **that is not equal to sum of elements of any subset.

**Constraints**

1 <= **T **<= 100

0 < **N **<= 10^{6}

0 <= **A[ ]** <= 10^{15}

**Examples **

**Input**

4

3

1 2 3

4

1 10 12 20

6

3 6 9 10 20 28

5

1 1 1 2 3

**Output**

7

2

1

9

**Explanation:
Testcase 1:** 7 is the smallest positive number for which any subset is not present with sum 7.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

tushki | 198 |

namansharmacse17 | 110 |

TusharMittal3 | 70 |

adkeaesph | 57 |

deepakchoudhary11 | 48 |

ARUN_PUNDIR | 720 |

manishgupta8497 | 623 |

AMAN__JAIN | 596 |

Abhimanyu_kumar | 562 |

Bicky_Shokeen | 532 |

blackshadows | 5335 |

Ibrahim Nash | 5223 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4584 |

Login to report an issue on this page.