Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Light The Candle

By soul_departed · Limits 1s, 1.0 GB

You have N candles of different lengths. For a candle of length L, you can light it for L minutes. Now there is load shedding in your city but as the exam is knocking, it’s necessary for you to study. You can study if there is any candle which is lit. Answer maximum amount of minutes you can study.

Input

First line contains number of test case T (1 ≤ T ≤ 20). Each case starts with N (1 ≤ N ≤ 10). The next line has N integers Li (1 ≤ Li ≤ 10) which is the length of the i’th candle.

Output

For each case, output maximum number of minutes you can study.

Sample

InputOutput
2
2 
1 4
3 
1 2 3

5
6


    Discussion
    Statistics

    97% Solution Ratio

    sakibalaminEarliest, Apr '18

    sadman12Fastest, 0.0s

    TSRaihanLightest, 0 B

    touhidurShortest, 76B

    Submit

    Login to submit