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