#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
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, cnt = 0;
for(int i = 7; i <= 11; i++)
for(int j = 12 - i; j <= i - 1; j++)
{
sum += x[i][j];
cnt += 1;
}
if (t == 'M') sum /= cnt;
printf("%.1lf", sum);
return 0;
}