#include <iostream>
#include <cstdio>
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 = 1; i < 12; i++)
{
for (int j = 11; j >= 12 - i; j--)
{
sum += a[i][j];
cnt ++;
}
}
if (t == 'S') printf("%.1lf", sum);
else printf("%.1lf", sum / cnt);
return 0;
}