#include <iostream>
#include <iomanip>
using namespace std;

#define SIZE	50

double prob[SIZE+3], temp[SIZE+3], lose[SIZE+3], tempLose[SIZE+3], delay[SIZE+3];
bool loseTurn[SIZE+3];
int squares[SIZE+3];

int getCmd(int index)
//
// read in next square command
//
{
	char ch;
	cin >> ch;
	if (ch == '0')
		return 0;
	if (ch == 'L') {
		loseTurn[index] = true;
		return 0;
	}
	int n;
	cin >> n;
	if (ch == '+')
		return n;
	else
		return -n;
}

int main()
{
	int nCase;
	cin >> nCase;
	for(int cases=1; cases<=nCase; cases++) {
		int m, t, i;
		cin >> m >> t;
		for(i=0; i<m+3; i++) {
			loseTurn[i] = false;
		}
      
		for(i=1; i<=m; i++) {
			squares[i] = getCmd(i);
		}
      
		squares[m+1] = squares[m+2] = 0;

		for(i=0; i<m+3; i++) {
			prob[i] = 0;
			lose[i] = 0;
			delay[i] = 0;
		}
		prob[0] = 1;
					// determine probs for being in each
					// square after each turn
		for(int turn=1; turn<=t; turn++) {
			for(i=0; i<m+3; i++) {
				tempLose[i] = temp[i] = 0.0;
			}
			for(i=0; i<m+1; i++) {
				if (loseTurn[i+1])
					tempLose[i+1] += 0.5*(prob[i] + lose[i]);
				else
					temp[i+1+squares[i+1]] += 0.5*(prob[i]+lose[i]);
				if (loseTurn[i+2])
					tempLose[i+2] += 0.5*(prob[i] + lose[i]);
				else
					temp[i+2+squares[i+2]] += 0.5*(prob[i]+lose[i]);
			}
			for(i=0; i<m+1; i++) {
				prob[i] = temp[i];
				lose[i] = delay[i];			// introduce one move delay for Lose Turn squares
				delay[i] = tempLose[i];
			}
			prob[m+1] += temp[m+1] + temp[m+2];
		}

		if (prob[m+1] > 0.5)
			cout << "Bet for. ";
		else if (prob[m+1] < 0.5)
			cout << "Bet against. ";
		else
			cout << "Push. ";
		if (prob[m+1] >= 0.99995)
			cout << "1.0000" << endl;
		else {
			cout.setf(ios::fixed,ios::floatfield);
			cout.precision(4);
			cout << prob[m+1] << endl;
		}
	}
	return 0;
}
