#include <bits/stdc++.h>
using namespace std;
const double p_suc = 1.0/4;
const double p_fail = 3.0/2000;
signed main()
{
int n = 5;
vector<vector<double> > dp(n, vector<double>(n, 0));
for(int i=1;i<n;++i){
dp[0][i] = 1.0;
}
for(int i=1;i<n;++i){
for(int j=1;j<n;++j){
dp[i][j] = (p_suc*dp[i-1][j] + p_fail * dp[i][j-1]) / (p_suc+p_fail);
}
}
for(int i=1;i<n;++i){
cout << i << " : " << setw(12) << 1.0 - dp[i][i] << " " << 1000*(1.0 - dp[i][i]) << "\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBkb3VibGUgcF9zdWMgPSAxLjAvNDsKY29uc3QgZG91YmxlIHBfZmFpbCA9IDMuMC8yMDAwOwoKc2lnbmVkIG1haW4oKQp7CiAgICBpbnQgbiA9IDU7CiAgICB2ZWN0b3I8dmVjdG9yPGRvdWJsZT4gPiBkcChuLCB2ZWN0b3I8ZG91YmxlPihuLCAwKSk7CiAgICBmb3IoaW50IGk9MTtpPG47KytpKXsKICAgICAgICBkcFswXVtpXSA9IDEuMDsKICAgIH0KICAgIGZvcihpbnQgaT0xO2k8bjsrK2kpewogICAgICAgIGZvcihpbnQgaj0xO2o8bjsrK2opewogICAgICAgICAgICBkcFtpXVtqXSA9IChwX3N1YypkcFtpLTFdW2pdICsgcF9mYWlsICogZHBbaV1bai0xXSkgLyAocF9zdWMrcF9mYWlsKTsKICAgICAgICB9CiAgICB9CiAgICBmb3IoaW50IGk9MTtpPG47KytpKXsKICAgICAgICBjb3V0IDw8IGkgPDwgIiA6ICIgPDwgc2V0dygxMikgPDwgMS4wIC0gZHBbaV1baV0gPDwgIiAiIDw8IDEwMDAqKDEuMCAtIGRwW2ldW2ldKSA8PCAiXG4iOwogICAgfQogICAgcmV0dXJuIDA7Cn0K