#include <iostream>
#include <cmath>
using namespace std;
int main()
{
char s = 'S' , m = 'M' , L ;
cin >> L ;
double x = 0 , count = 0;
int d = 11 ,c = 0;
for (int i = 0; i < 12 ; i ++ )
{
for (int j = 0; j < 12; j ++ )
{
cin >> x ;
if( abs(i - d) + j < d) count += x , c++ ; //曼哈顿改一个数
}
}
if(L == s) printf("%.1lf" , count);
if(L == m) printf("%.1lf" , count / c);
return 0;
}