/*--.--.--.--.--.--.--.--.--.--.--.--.--*
* By-Rohit Singh *
* CS , MNNIT Allahabad *
* rohitmnnit1459@gmail.com *
*--.--.--.--.--.--.--.--.--.--.--.--.--*/
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
#include <limits.h>
#include <assert.h>
//#include <unordered_map>
using namespace std;
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define null NULL
#define ll long long
#define llu unsigned long long
#define MAX 2300000
#define mod 100000007
#define inf 100000000
#define pp pair <int, int>
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <ldb, ldb> pdd;
const db PI = 3.141592653589793238;
#define abs(x) ((x)>0?(x):-(x))
#define pop pop_back()
#define scan(x) scanf("%d",&x)
#define print(x) printf("%d\n",x)
#define scanll(x) scanf("%lld",&x)
#define printll(x) printf("%lld\n",x)
//**********************************************HAPPY CODDING*****************************************************/
double dp[4005][4000];
void ini() {
int i, j;
for (i = 0 ; i <= 750 ; i++) {
for (j = 0 ; j <= 3500 ; j++) {
dp[i][j] = -1;
}
}
}
double faverable(int sum, int ind) {
if (sum < ind || sum > ind*6) {
return 0;
}
if (dp[sum][ind] != -1) {
return dp[sum][ind];
}
if (ind == 1) {
dp[sum][ind] = (double)100/6.0;
}
else {
double ans = 0;
for (int i = 1 ; i <= 6 ; i++) {
ans += faverable(sum-i, ind-1);
}
dp[sum][ind] = (double)ans/6.0;
}
return dp[sum][ind];
}
int main() {
int t, n, k;
ll kk;
scanf("%d", &t);
while (t--) {
ini();
scanf("%d %d", &n, &k);
if (k < n || k > n*6 || n > 600 || k > 3500) {
printf("0\n");
continue;
}
kk = (ll)faverable(k, n);
printf("%lld\n", kk);
}
return 0;
}
LyotLS4tLS4tLS4tLS4tLS4tLS4tLS4tLS4tLS4tLS4tLS4tLS4tLSoKICogIAlCeS1S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