Under construction

Still being built. Things may change

Voyage

Time limit1sMemory limit1024 MB

Summary
Given N sandwiches, cut meals of length X to Y cm from them to maximize the meal count, then minimize the total length of discarded remainders.
Level

Medium6 of 10

Topics
Greedy, Sorting, Binary search
Solved
No attempts yet

Problem

Junwon starts a voyage today. The only food Junwon has is NN Subway sandwiches. The length of the ii-th sandwich is AiA_i cm.

At each meal, Junwon cuts a little from one of the sandwiches. Specifically, he picks one of the NN sandwiches and cuts off a piece whose length is at least XX cm and at most YY cm. If the remainder after cutting is less than XX cm, Junwon throws it away. (Junwon does not do shabby things like combining several small pieces to eat.)

Using the sandwiches he has, find the maximum number of meals Junwon can solve. Then, after solving that many meals, find the minimum possible total length of the discarded sandwich pieces.

Input

The first line contains NN, XX, and YY, separated by spaces.

The second line contains the lengths A1,A2,⋯ ,ANA_1, A_2, \cdots, A_N, separated by spaces.

Output

The first line prints the maximum number of meals Junwon can solve.

The second line prints the minimum total length of the discarded sandwich pieces.

Constraints

  • 1≤N≤40 0001 \le N \le 40\,000
  • 1≤X≤Y≤40 0001 \le X \le Y \le 40\,000
  • For each ii (1≤i≤N1 \le i \le N), 1≤Ai≤40 0001 \le A_i \le 40\,000.

Examples1

  1. Example 1

    Input
    6 10 12
    11 10 17 5 23 28
    
    Expected output
    7
    14