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

#BS0000291. Giá mua bình phương (Square Price)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Giá mua bình phương (Square Price)

Square Price

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

A shop has NN product types, each with 1010010^{100} units available. Buying kik_i units of type ii costs Piki2P_i k_i^2, where kik_i may be zero. Find the maximum total number of units within budget MM.

Input

First line: N,MN,M. Second line: NN integers PiP_i.

Output

Print one integer: the maximum achievable value.

Subtasks

  • Subtask 1 (20 points): 1≤N≤301\le N\le30; 1≤M≤1001\le M\le100; 1≤Pi≤1001\le P_i\le100.
  • Subtask 2 (30 points): 1≤N≤2⋅1051\le N\le2\cdot10^5; 1≤M≤10181\le M\le10^{18}; 1≤Pi≤2⋅1091\le P_i\le2\cdot10^9; P1=⋯=PNP_1=\cdots=P_N.
  • Subtask 3 (50 points): 1≤N≤2⋅1051\le N\le2\cdot10^5; 1≤M≤10181\le M\le10^{18}; 1≤Pi≤2⋅1091\le P_i\le2\cdot10^9.

Examples

Input 1

3 9
4 1 9

Output 1

3

Explanation

One unit of type 1 and two of type 2 cost 8. The four cheapest marginal prices sum to 13.

Input 2

10 1000
2 15 6 5 12 1 7 9 17 2

Output 2

53

Explanation

53 units fit within the budget; 54 do not.