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

#BS0000297. Sagheer và chợ Nubia (Sagheer and Nubian Market)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Sagheer và chợ Nubia (Sagheer and Nubian Market)

Sagheer and Nubian Market

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn distinct souvenirs indexed from 1 to nn, with base prices aia_i. When exactly kk items are bought, the actual price of each selected item ii is ai+ika_i+ik. Each item can be bought at most once. With budget SS, maximize the item count and then minimize total cost for that count.

Input

First line: n,Sn,S. Second line: nn integers a1,…,ana_1,\ldots,a_n.

Output

Print two integers k,Tk,T: the maximum count and its minimum cost. Print 0 0 if no item is affordable.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le12; 1≤S≤10001\le S\le1000; 1≤ai≤1001\le a_i\le100.
  • Subtask 2 (30 points): 1≤n≤1051\le n\le10^5; 1≤S≤1091\le S\le10^9; 1≤ai≤1051\le a_i\le10^5; a1=⋯=ana_1=\cdots=a_n.
  • Subtask 3 (50 points): 1≤n≤1051\le n\le10^5; 1≤S≤1091\le S\le10^9; 1≤ai≤1051\le a_i\le10^5.

Examples

Input 1

3 11
2 3 5

Output 1

2 11

Explanation

For k=2, prices are 4,7,11; choose the first two, costing 11. Three items cost 28.

Input 2

1 7
7

Output 2

0 0

Explanation

The sole item costs 8 if one item is bought.