#include<iostream>
using namespace std;
int main()
{
char c;
cin >> c;
double a[12][12];
for(int i = 0;i < 12;i ++)
for(int j = 0;j < 12;j ++) cin >> a[i][j];
double sum = 0;
for(int j = 0;j < 12;j ++)
for(int i = j + 1;i < 11 - j;i ++) //相较于749 可以把行和列反过来看
sum += a[i][j];
if( c == 'S') printf("%.1lf\n",sum);
if( c == 'M') printf("%.1lf\n",sum / 30);
return 0;
}