#include #include #include #include

using namespace std;

typedef long long dint;

const int maxn = 1000009;

int n, m, l, r; dint a[maxn], b[maxn], ss[maxn], sv[maxn], sa[maxn], sr[maxn], tot; double ans;

int main() { #ifndef ONLINE_JUDGE freopen(“in.txt”, “r”, stdin); #endif

scanf("%d%d%d%d", &n, &m, &l, &r);
memset(sv, 0, sizeof(sv));
memset(sa, 0, sizeof(sa));
tot = 0;
for (int i = 1; i + l - 1 <= n; ++ i) {
    int li(i + l - 1), ri(min(n, i + r - 1));
    tot += ri - li + 1;
    sv[i] += ri - li + 1;
    sv[ri + 1] -= ri - li + 1;
    if (li < ri) {
        sa[li + 1] -= 1;
        sa[ri + 1] += 1;
        sr[ri + 1] += ri - li;
    }
}
a[0] = b[0] = 0;
dint ad(0);
for (int i = 1; i <= n; ++ i) {
    ad += sa[i];
    a[i] = a[i - 1] + sv[i];
    b[i] = b[i - 1] + ad + sr[i];
}
for (int i = 1; i <= n; ++ i)
    a[i] += b[i];
ans = 0;
for (int i = 1; i <= n; ++ i)
    ans += 1.0 - pow(((double)tot - a[i]) / (double)tot, m);
printf("%.3lf\n", ans);

}