#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
cin >> n;
char t;
cin >> t;
double x[12][12];
for(int i = 0; i < 12; i++)
for (int j = 0; j < 12; j++)
cin >> x[i][j];
double sum = 0;
for(int i = 0; i < 12; i++) sum += x[i][n];
if(t == 'M') sum /= 12;
printf("%.1lf", sum);
return 0;
}