#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>

using namespace std;

#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define SORT(x) sort((x).begin(),(x).end())
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
	os << "[";
	for (const auto &v : vec) {
		os << v << ",";
	}
	os << "]";
	return os;
}

int ans[10500];

void AddReciprocal(int x){
	int t=1;
	REP(i,0,10200){
		if(!t) break;
		ans[i]+=t/x;
		t%=x;
		t*=10;
	}
}

void CarryUp(){
	for(int i=10199; i>=0; --i){
		ans[i-1]+=ans[i]/10;
		ans[i]%=10;
	}
}

void Solve(){
	int n,m,k,r;
	while(true){
		cin >> n >> k >> m >> r;
		if(n+m+k+r==0) break;

		fill(ans,ans+10500,0);
		AddReciprocal(n);
		if(m==1){
			REP(i,1,n){
				AddReciprocal(i*n);
			}
		}
		CarryUp();
		
		cout << ans[0] << '.';
		REP(i,1,r+1) cout << ans[i];
		cout << endl;
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	Solve();
	return 0;
}