By Neilor Tonin, URI Brazil
Read an uppercase character that indicates an operation that will be performed in an array M. Then, calculate and print the sum or average considering only that numbers that are included in the green area of this array, like shown in the following figure.
The first line of the input contains a single uppercase character O ('S' or 'M'), indicating the operation Sum or Average (Média in portuguese) to be performed with the elements of the array. Follow 144 double numbers of the array.
Print the calculated result (sum or average), with one digit after the decimal point.
|Input Sample||Output Sample|