Hide

Problem J
Water Slide Waste (Easy)

Water isn’t cheap, and it’s a shame to waste it. That’s why Wally of Wally’s Water Park wants your help figuring out how much water he will need to run all of the water slides in his park.

Input

The first line of the input contains a single integer $n$ ($1\leq n\leq 10^6$), the number of slides in Wally’s park. The next line contains $n$ integers $w_i$ ($0\leq w_i\leq 10^3, 0\leq i < n$) the amount of water (in litres) needed to run the $ith$ slide.

Output

Output a single integer, the minimum amount of water (in litres) needed to run all of the slides in Wally’s park.

Sample Input 1 Sample Output 1
3
1 2 3
6
Sample Input 2 Sample Output 2
6
5 2 3 5 1 4
20

Please log in to submit a solution to this problem

Log in