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