#include <iostream>
using namespace std;
double arr[12][12];
double sum;
int main(void)
{
int n;
cin >> n;
char op;
cin >> op;
for (int i = 0; i < 12; i++) {
for (int j = 0; j < 12; j++) {
cin >> arr[i][j];
if (i == n) sum += arr[i][j];
}
}
if (op == 'S') printf("%.1f\n", sum);
else printf("%.1f\n", sum / 12);
return 0;
}