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

#GD0000093. Phiếu giảm giá mạnh (Powerful Discount Tickets)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Phiếu giảm giá mạnh (Powerful Discount Tickets)

Powerful Discount Tickets

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn items with initial prices aia_i and mm discount tickets. Each ticket halves the current price of a chosen item, rounding down. You may use several tickets on the same item. Find the minimum total amount needed to buy all items.

Input

The first line contains integers n,mn,m; the second contains nn prices a1,…,ana_1,\ldots,a_n.

Output

Print one integer: the minimum total cost.

Subtasks

  • Subtask 1 (20 points): 1≤n≤241\le n\le 24; 1≤m≤241\le m\le24; 1≤ai≤1091\le a_i\le 10^9 for every ii.
  • Subtask 2 (30 points): 1≤n≤15001\le n\le 1500; 1≤m≤15001\le m\le1500; 1≤ai≤1091\le a_i\le 10^9 for every ii.
  • Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000; 1≤m≤1000001\le m\le100000; 1≤ai≤1091\le a_i\le 10^9 for every ii.

Examples

Input

3 3
2 13 8

Output

9

Explanation

The original prices are 2,13,82,13,8. Two coupons change 1313 to 33, and one changes 88 to 44. The first item stays 22, giving 2+3+4=92+3+4=9.