Author:  I. Ludov  Time limit:  4 sec  
Input file:  input.txt  Memory limit:  256 Mb  
Output file:  output.txt 
A software development company named "Adnor" is starting a new challenging project: a video analytic application capable of classifying some features of people from images of their faces. One of such features is the age of the person. Since the problem of precise age recognition is still open and very difficult, for now the company will solve a slightly easier one: the system must determine an age interval to which the owner of presented face belongs.
Age interval is defined by minimum and maximum age, for example:
Interval name  Lower bound  Upper bound 
Young  1  18 
Adult  19  55 
Senior  56  100 
Most modern automatic classification methods are comprised of two steps: learning from a set of training samples, and classification itself.
For the training set, "Adnor" company has a database of face images with the exact age of each presented person. The training set is split into subsets according to desired age intervals and fed to the learning algorithm.
Sales division determined that the classifier should be able to distinguish between M age intervals. There is some freedom in choosing interval bounds, but for the optimal recognition quality training subset sizes should not differ too much. Strictly speaking, an entropy, measured in nats of sizes of these subsets should not be less than some constant E. Here entropy is defined as:
− (1 / S) × ∑s_{i}ln(s_{i} / S), where s_{i} is a subset size, and S — the sum of all subset sizes.
If this condition is not satisfied, some images should be excluded from one or more subsets to make their sizes closer and hence rise the entropy. Still, the training data should not be wasted, so some splitting must be found which uses as many samples as possible while having an entropy above or equal to E. Your task is to write a program which would find such an optimal splitting.
Input file contains integers N M — maximum age in face images database and number of age intervals, followed by floating point number E — the lowest acceptable entropy value.
Following are N integers a_{1}.. a_{N}, where a_{i} is the number of available samples for age of i years.
It is guaranteed that at least one solution exists.
Output file should contain M triplets of integer numbers l_{i} r_{i} s_{i}, each one corresponding to one age interval. l_{i} is lower age bound, r_{i} is upper age bound and s_{i} is the number of samples that should be used in the training subset for the ith interval. Intervals should be sorted in ascending order of their lower bounds. They should not overlap and must have nonempty training subsets (s_{i} > 0). If there is more than one solution, output any of them.
1 ≤ N ≤ 100; 1 ≤ M ≤ 10; 0 ≤ a_{i} ≤ 10; 0 ≤ E ≤ 100;
There are no more than 50 nonzero values of a_{i}.
No.  Input file (input.txt ) 
Output file (output.txt ) 

1 


2 

