```
include [HTML_REMOVED]
using namespace std;
int main()
{
int N=12;
char flag;
int count =0;
double M[N][N];
double sum=0;
cin >> flag;
for(int i=0;i<N;i)
for(int j=0;j<N;j)
scanf(“%lf”,&M[i][j]);
for(int i=0;i<(N-1)/2;i)
for(int j=i+1;j<N-i-1;j)
{
sum += M[i][j];
count ++;
}
if(flag == 'S') printf("%.1lf",sum);
if(flag == 'M') printf("%.1lf",sum/count);
return 0;
}
```