#BS0000066. Sao chép sách (Copying Books)

Sao chép sách (Copying Books)

Copying Books

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

There are mm books in fixed order, with pip_i pages. Partition them into exactly kk non-empty contiguous groups, one per scribe. Minimize the maximum group sum. The PHOJ version asks only for this unique optimal value.

Input

The first line contains m,km,k. The second line contains p1,…,pmp_1,\ldots,p_m.

Output

Print the minimum possible maximum workload.

Subtasks

  • Subtask 1 — 20%: m≤30m\le30.
  • Subtask 2 — 30%: m≤200m\le200.
  • Subtask 3 — 50%: 1≤k≤m≤5001\le k\le m\le500, 1≤pi<1071\le p_i<10^7.

Example

Input

9 3
100 200 300 400 500 600 700 800 900

Output

1700

Explanation

An optimal partition has maximum group sum 1700.