#include<bits/stdc++.h>
using namespace std;
char c;
double m[15][15];
double sum;
int s[60][2]={
{1,5},{1,6},
{2,4},{2,5},{2,6},{2,7},
{3,3},{3,4},{3,5},{3,6},{3,7},{3,8},
{4,2},{4,3},{4,4},{4,5},{4,6},{4,7},{4,8},{4,9},
{5,1},{5,2},{5,3},{5,4},{5,5},{5,6},{5,7},{5,8},{5,9},{5,10},
{6,1},{6,2},{6,3},{6,4},{6,5},{6,6},{6,7},{6,8},{6,9},{6,10},
{7,2},{7,3},{7,4},{7,5},{7,6},{7,7},{7,8},{7,9},
{8,3},{8,4},{8,5},{8,6},{8,7},{8,8},
{9,4},{9,5},{9,6},{9,7},
{10,5},{10,6}
};
int main(){
cin>>c;
for(int i=0;i<12;i++){
for(int j=0;j<12;j++) cin>>m[i][j];
}
if(c=='S'){
for(int i=0;i<60;i++) sum+=m[s[i][0]][s[i][1]];
}
else{
for(int i=0;i<60;i++) sum+=m[s[i][0]][s[i][1]];
sum/=60;
}
printf("%.1lf",sum);
return 0;
}