#include <bits/stdc++.h>
using namespace std;
double a, ans, cnt;
int main() {
int l;
char t;
cin >> l >> t;
for (int i = 0; i < 12; i ++ ) {
for (int j = 0; j < 12; j ++ ) {
cin >> a;
if (j == l) ans += a, cnt ++;
}
}
if(t == 'M') ans /= cnt;
printf("%.1lf", ans);
}
nb