CD Recording#4198

CD Recording

1 second
64 megabytes
Medium

You have two identical drives and must record CDs. The recording time for each CD is given in the array A_1, A_2, \ldots, A_K. Your task is to determine the minimum time required to record all the CDs, with each CD being recorded fully on one of the drives.

Input

The first line contains the integer , representing the number of CDs. The second line contains the elements of the array A_1, A_2, \ldots, A_K, where each element is a natural number not exceeding , representing the recording time for each CD.

Output

Output the minimum time required to complete the recording of all CDs.

Examples

Example 1

Loading
Loading