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