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

#GD0000029. Devu học bài (Devu, the Dumb Guy)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Devu học bài (Devu, the Dumb Guy)

Devu, the Dumb Guy

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn subjects with difficulties cic_i. The initial multiplier is xx; after each learned subject it decreases by 11 but never below 11. The cost of a subject is its difficulty times the current multiplier. Minimize total cost.

Input

The first line contains n,xn,x. The second line contains cic_i.

Output

Print the minimum total cost.

Constraints

  • 1≤n,x≤1051\le n,x\le 10^5.
  • 1≤ci≤1051\le c_i\le 10^5 for 1≤i≤n1\le i\le n.

Subtasks

  • Subtask 1 (20 points): n≤8n\le 8.
  • Subtask 2 (30 points): n≤30n\le 30.
  • Subtask 3 (50 points): Full constraints.

Examples

Input

3 3
1 3 2

Output

10

Explanation

The sample follows the ordering rule described in the Vietnamese explanation and produces the shown optimum.