#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double a[12][12];
char t;
cin >> t;
for (int i = 0; i < 12; i++)
for (int j = 0; j < 12; j++) cin >> a[i][j];
double sum = 0, cnt = 0;
for (int i = 11; i > 6; i--)
{
for (int j = 1 + abs(11 - i); j <= i - 1; j++)
{
sum += a[i][j];
cnt ++;
}
}
if (t == 'S') printf("%.1lf", sum);
else printf("%.1lf", sum / cnt);
return 0;
}