#include<stdio.h>
#define R 12
#define C 12
int main()
{
int row,i,j;
double a[R][C],sum = 0.0,ave;
char ch;
scanf("%d",&row);
scanf(" %c",&ch);
for ( i = 0; i < R; i++)
for( j = 0; j < C; j++)
scanf("%lf",&a[i][j]);
if(ch == 'S'){
for( j = 0; j < R; j++)
sum += a[row][j];
printf("%.1f",sum);
}
if (ch =='M'){
for( j = 0; j < R; j++)
sum += a[row][j];
ave = 1.0 * sum / C;
printf("%.1f",ave);
}
return 0;
}