#include <iostream>
using namespace std;
int main(){
char op[5]; cin >> op;
double sum = 0.0;
for(int i = 0; i < 12; i ++ ){
for(int j = 0; j < 12; j ++ ){
double tmp; cin >> tmp;
if(i + j < 11 && j > i) sum += tmp;
}
}
if(op[0] == 'M') sum /= (12 * 10) / 4;
printf("%.1lf", sum);
return 0;
}