#include<bits/stdc++.h>
using namespace std;
int main(){
double a[12][12];
char c;
cin >> c;
double cnt = 0;
for(int i = 0; i < 12; i ++){
for (int j = 0 ; j < 12; j ++){
double x;
cin >> x;
if(j >= i + 1 && j >= 12 - i){
cnt += x;
}
}
}
if(c == 'S'){
cout << fixed << setprecision(1) << cnt << endl;
}else{
cout << fixed << setprecision(1) << cnt / 30.0 << endl;
}
return 0;
}