sm = input()
m = []
s = 0
am = 0
for i in range(12):
m.append(list(map(float,input().split())))
a = 0
b = 5
for i in range(0,6):
for j in range(a):
s += m[i][j]
am += 1
a += 1
for i in range(6,11):
for j in range(b):
s += m[i][j]
am += 1
b -= 1
if sm == 'S':
print("%.1lf"%s)
elif sm == 'M':
print("%.1lf"%(s/am))