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