#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
cin >> n;
char c;
cin >> c;
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 j = 0; j < 12; j++)
{
sum += x[n][j];
// cout << "sum = " << sum << endl;
}
if(c == 'M') sum /= 12.0;
printf("%.1lf", sum);
return 0;
}