Problem: T.I. Financial Group, a world-famous group of finance companies, has decided to hold an evil gambling game in which insolvent debtors compete for special treatment of exemption from their debts.

In this game, each debtor starts from one cell on the stage called the Deadly Ring. The Deadly Ring consists of N cells and each cell is colored black or red. Each cell is connected to exactly two other adjacent cells and all the cells form a ring. At the start of the game, each debtor chooses which cell to start. Then he rolls a die and moves on the ring in clockwise order by cells as many as the number of spots shown on the upside of the die. This step is called a round, and each debtor repeats a round T times. A debtor will be exempted from his debt if he is standing on a red cell after he finishes all the rounds. On the other hand, if he finishes the game at a black cell, he will be sent somewhere else and forced to devote his entire life to hard labor.

You have happened to take part in this game. As you are allowed to choose the starting cell, you want to start from a cell that maximizes the probability of finishing the game at a red cell. Fortunately you can bring a laptop PC to the game stage, so you have decided to write a program that calculates the maximum winning probability.



Input

The input consists of multiple datasets.

Each dataset consists of two lines. The first line contains two integers N (1 ≤ N ≤ 2000) and T (1 ≤ T ≤ 2000) in this order, delimited with a single space. The second line contains a string of N characters that consists of characters ‘R’ and ‘B’, which indicate red and black respectively. This string represents the colors of the cells in clockwise order.

The input is terminated by a line with two zeros. This is not part of any datasets and should not be processed.

Output

For each dataset, print the maximum probability of finishing the game at a red cell in one line. Your program may output an arbitrary number of digits after the decimal point, provided that the absolute error does not exceed 10-8.

Example

Input

6 1
RBRBRB
10 1
RBBBRBBBBB
10 2
RBBBRBBBBB
10 10
RBBBBBBBBB
0 0


Output

0.50000000
0.33333333
0.22222222
0.10025221

Solution (in CPP):

Solution:
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

double memo[2000][2001];
double prob(int k, int t, const string& s){
  if(memo[k][t] >= 0) return memo[k][t];
  double& res = memo[k][t];
  if(t == 0 && s[k] == 'R') return res = 1;
  if(t == 0 && s[k] == 'B') return res = 0;
  const int N = s.size();
  res = 0;
  for(int d = 1; d <= 6; d++){
    res += prob((k + d) % N, t - 1, s) / 6.0;
  }
  return res;
}

int main(){
  int N, T;
  while(cin >> N >> T && N){
    // REP(i, N)REP(j, T + 1) memo[i][j] = -1;
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    /*
    double ans = 0;
    REP(i, N){
      ans = max(ans, prob(i, T, s));
    }
    */
    static double dp[2001][2000] = {};
    REP(i, T + 1)REP(j, N) dp[i][j] = 0;
    REP(i, N) dp[0][i] = (s[i] == 'R') ? 1.0 : 0.0;
    for(int t = 0; t < T; t++){
      for(int i = 0; i < N; i++){
        int curr = i;
        for(int d = 1; d <= 6; d++){
          curr++;
          if(curr == N) curr = 0;
          dp[t + 1][curr] += dp[t][i] / 6.0;
        }
      }
    }
    double ans = 0;
    REP(i, N) ans = max(ans, dp[T][i]);
    printf("%.16lf\n", ans);
  }
  return 0;
}