Problem:
Score : 400 points

Problem Statement

You are given N items.

The value of the i-th item (1 \leq i \leq N) is v_i.

Your have to select at least A and at most B of these items.

Under this condition, find the maximum possible arithmetic mean of the values of selected items.

Additionally, find the number of ways to select items so that the mean of the values of selected items is maximized.

Constraints

1 \leq N \leq 50

1 \leq A,B \leq N

1 \leq v_i \leq 10^{15}

Each v_i is an integer.

Input

The input is given from Standard Input in the following format:

N A B
v_1
v_2
...
v_N

Output

Print two lines.

The first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6}.

The second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.

Sample Input 1

5 2 2
1 2 3 4 5

Sample Output 1

4.500000
1

The mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5.

There is no other way to select items so that the mean of the values will be 4.5, and thus the second line of the output should contain 1.

Sample Input 2

4 2 3
10 20 10 10

Sample Output 2

15.000000
3

There can be multiple ways to select items so that the mean of the values will be maximized.

Sample Input 3

5 1 5
1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996

Sample Output 3

1000000000000000.000000
1

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long
//階乗
 
ll Factrial(ll num){
  if(num==1||num==0){
    return 1;
  }else if(num<0){
    printf("ERROR_minus\n");
    return 0;
  }else{
    return num*Factrial(num-1);
  }
}
 
long long modinv(long long a, long long m) {//modの逆元
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

ll linercomb(ll n,ll k, ll mod){//n,kの線形時間で求める
  ll ans=1;
  for(ll i=n;i>=n-k+1;i--){
    ans*=i;
    ans%=mod;
  }
  ll k1=Factrial(k);
  k1%=mod;
  ans*=modinv(k1,mod);
  ans%=mod;
  return ans;
}
int main(void){
  ll n,a,b;
  cin>>n>>a>>b;
  vector<long double> v(n);
  rep(i,n)cin>>v[i];
  sort(v.begin(),v.end());
  ld tmp=0;
  for(int i=n-a-1+1;i<n;i++){
    tmp+=v[i];
  }
  tmp/=(long double)a;
  cout<<tmp<<endl;
  ll num2=0;
  for(int i=n-a-1+1;i<n;i++){
    if(v[n-a-1+1]==v[i]){
      num2++;
    }else{
      break;
    }
  }
  ll num=0;
  for(int i=n-a-1-1+1;i>=0;i--){
    if(v[i]==v[n-a-1-1]){
      num++;
    }else{
      break;
    }
  }
  if(v[n-1]!=v[n-1-a-1]){
    cout<</* num1+numCnum1 */linercomb(num2+num,num2,d9_7)<<endl;
  }else{
    cout<<(ll)pow(2,num2+num)<<endl;
  }
  return 0;
}