#include <cstdio>
int main () {
double a[12][12];
int l;
double s = 0;
char op;
scanf("%d\n%c", &l, &op);
for (int i = 0; i < 12; i ++ )
for (int j = 0; j < 12; j ++ )
scanf("%lf", &a[i][j]);
for (int j = 0; j < 12; j ++ )
s += a[l][j];
if (op == 'S') printf("%.1lf\n", s);
else printf("%.1lf\n", s / 12.0);
return 0;
}