#include<iostream>
#include<cstdio>
using namespace std;
double a[15][15];
int main(){
int c;
cin>>c;
char flag;
cin>>flag;
for(int i=1;i<=12;i++){
for(int j=1;j<=12;j++){
cin>>a[i][j];
}
}
double sum = 0.0;
for(int i=1;i<=12;i++) sum += a[i][c + 1];
if(flag == 'S') printf("%.1lf",sum);
else printf("%.1lf",sum/12);
}