PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000131. Băng dính sửa thanh gỗ (Tape)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Băng dính sửa thanh gỗ (Tape)

Tape

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

A stick consists of mm unit segments, with nn broken positions bib_i given in strictly increasing order. Use at most kk contiguous integer-length tape pieces to cover all broken segments, possibly covering intact segments too. Minimize the total tape length.

Input

The first line contains n,m,kn,m,k. The next line contains nn positions bib_i.

Output

Print the minimum total length of tape.

Subtasks

  • Subtask 1 (20 points): 1≤k≤n≤201\le k\le n\le 20; n≤m≤109n\le m\le10^9; 1≤b1<b2<⋯<bn≤m1\le b_1<b_2<\cdots<b_n\le m.
  • Subtask 2 (30 points): 1≤k≤n≤12001\le k\le n\le 1200; n≤m≤109n\le m\le10^9; 1≤b1<b2<⋯<bn≤m1\le b_1<b_2<\cdots<b_n\le m.
  • Subtask 3 (50 points): 1≤k≤n≤1000001\le k\le n\le 100000; n≤m≤109n\le m\le10^9; 1≤b1<b2<⋯<bn≤m1\le b_1<b_2<\cdots<b_n\le m.

Examples

Input

4 100 2
20 30 75 80

Output

17

Explanation

A tape piece of length 1111 covers positions 2020 and 3030; another of length 66 covers 7575 and 8080. Total 1717.