#include<iostream>
using namespace std;
int main(){
double a[12][12],sum=0;
char op;
cin>>op;
int i,j;
for(i=0;i<12;i++){
for(j=0;j<12;j++){
cin>>a[i][j];
if(i<j&&i+j<11) sum+=a[i][j];
}
}
printf("%.1lf",op=='S'?sum:sum/30);
return 0;
}