#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class CollectingBonuses { public:
	double expectedBuy(string n, string k) 
	{
		LL N; {stringstream ss; ss<<n; ss>>N;}
		LL K; {stringstream ss; ss<<k; ss>>K;}
		return N * sigma(K,N);
	}
	double f(LL b)
	{
		return 0.5772156649015313 + log(b+0.5);
	}
	double sigma(LL k, LL n)
	{
		// compute (1/n-k+1 + ... + 1/n)

		if(k<=10000000) {
			double p=0.0;
			for(LL i=0; i<k; ++i)
				p += 1.0 / (n-i);
			return p;
		}
		else if(n-k<=10000000) {
			double p=0.0;
			for(LL i=1; i<=n-k; ++i)
				p += 1.0 / i;
			return f(n) - p;
		}
		LL x = 2*n+1;
		LL y = 2*n-2*k+1;
		if( x<y*2 )
			return log1p(double(x-y)/y);
		else
			return log( double(x)/y );
	}

};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const double& Expected, const double& Received) {
 bool ok = (abs(Expected - Received) < 1e-9);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, CollectingBonuses().expectedBuy(n, k));}
int main(){

CASE(0)
	string n = "1"; 
	string k = "1"; 
	double _ = 1.0; 
END
CASE(1)
	string n = "2"; 
	string k = "1"; 
	double _ = 1.0; 
END
CASE(2)
	string n = "2"; 
	string k = "2"; 
	double _ = 3.0; 
END
CASE(3)
	string n = "4"; 
	string k = "3"; 
	double _ = 4.333333333333333; 
END
CASE(4)
	string n = "999999999999999999"; 
	string k = "999999999999999999"; 
	double _ = 4.202374733879435E19; 
END
/*
CASE(5)
	string n = ; 
	string k = ; 
	double _ = ; 
END
*/
}
// END CUT HERE
