c = int(input()) sm = input() m = [] s = 0 for i in range(12): m.append(list(map(float,input().split()))) for i in range(12): s += m[i][c] if sm == 'S': print("%.1lf"%s) elif sm == 'M': print("%.1lf"%(s/12))