#include #include using namespace std; using namespace atcoder; #define rep(i, n) REP(i, 0, n) #define REP(i, s, e) for (ll i = (s); i < (ll)(e); i++) #define repr(i, n) REPR(i, n, 0) #define REPR(i, s, e) for (ll i = (ll)(s - 1); i >= (ll)(e); i--) #define all(r) r.begin(), r.end() #define rall(r) r.rbegin(), r.rend() typedef long long ll; typedef vector vi; typedef vector vl; template bool chmax(T& a, const U& b) { if (a >= b) return false; a = b; return true; } template bool chmin(T& a, const U& b) { if (a <= b) return false; a = b; return true; } void yes_no(bool f, string yes = "Yes", string no = "No") { cout << (f ? yes : no) << "\n"; } void solve() { int n, k; cin >> n >> k; using D = long double; const int ma = 150; vector dp(ma, 0), ep(ma, 0); dp[0] = 1; ep[0] = 1; D p = (D)1 / 6; rep(i, n) { vector nxt(ma, 0); rep(j, ma - 6) REP(x, 1, 7) { nxt[j + x] += dp[j] * p; } swap(dp, nxt); } rep(i, n - k) { vector nxt(ma, 0); rep(j, ma - 6) REP(x, 1, 7) { nxt[j + x] += ep[j] * p; } swap(ep, nxt); } rep(i, k) { vector nxt(ma, 0); rep(j, ma - 6) REP(x, 4, 7) { nxt[j + x] += ep[j] * p; nxt[j + x] += ep[j] * p; } swap(ep, nxt); } D ans = 0; rep(i, ma) rep(j, i) { ans += ep[i] * dp[j]; } cout << fixed << setprecision(15); cout << ans << "\n"; } int main() { cin.tie(0); ios::sync_with_stdio(false); int t = 1; // cin >> t; rep(ti, t) solve(); return 0; }