KSMALSUM - Sum of the smallest K elements of an array

Find the sum of the smallest K elements of an array of N integers.

Input

The first line of input gives the size of the array, N (0 < N < 220). The following N lines to have elements of the array, one element per line (0 < element < 220). The following line gives K (0 < K < 220 and K <= N).

Output

Sum of the smallest K elements of the given array.

Example

Input:
5
20
40
30
50
10
3 Output: 60

Added by:Prof. Channa Bankapur
Date:2016-03-11
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.