#include<cstdio>
int main(){
double m[12][12];
char s;
scanf("%c", &s);
for(int i = 0; i < 12; ++i)
for(int j = 0; j < 12; ++j)
scanf("%lf", &m[i][j]);
double sum = 0.0;
int c = 0;
for(int j = 7; j < 12; ++j)
for(int i = 12 - j; i < j; ++i){
sum += m[i][j];
++ c;
}
if(s == 'S')
printf("%.1lf", sum);
else
printf("%.1lf", sum / c);
return 0;
}