#include <bits/stdc++.h>   using namespace std;   double dp[2][605];   int main() {     int n, k;     scanf( %d%d , &n, &k);     int pre = 0, cur = 1;     for (int i = 0; i < n; ++i) {       memset(dp[cur], 0, sizeof dp[cur]);       for (int j = 1; j < 600; ++j)         dp[cur][j] += (1. * j / k / (j + 1) + (k - 1.) / k) * dp[pre][j] +                       1. * (dp[pre][j + 1] + j) / ((j + 1.) * k) + 1. * j / 2 / k;       swap(pre, cur);     }     printf( %.15f n , k * dp[pre][1]);     return 0;   }   