CSES - Shared codeLink to this code: https://cses.fi/paste/de47217d92ecadd161ebed/
#include <bits/stdc++.h>
using namespace std;


//Getting faster
#define repeat(i,s,e) for(long long i=s;i<e;i++)
#define ll long long


double dp[601][101];

int main(){
    ll n,a,b; cin>>n>>a>>b;
    dp[1][1]=dp[2][1]=dp[3][1]=dp[4][1]=dp[5][1]=dp[6][1]=1;

    repeat(i,2,n+1){
        ll d = 0; // d is just storing the total sum in table for the i-th turn
        repeat(j,1,601){
            repeat(k,1,7){
                if (j-k<0) continue;
                dp[j][i] += dp[j-k][i-1];
            }
            d+=dp[j][i];
        }
        if (d==0) continue; // Just in case...
        repeat(j,1,601){
            dp[j][i] /= d;
        }
    }
    
    double s = 0;
    double ts = 0;
    
    repeat(i,0,601){
        ts+=dp[i][n];
        if (i>=a and i<=b) s += dp[i][n];
    }

    cout<<fixed<<setprecision(6)<<s/ts;

    return 0;
}