#include #include using namespace std; const int BUF = 25; int n; void read() { cin >> n; } double bino(int n, int k) { return k == 0 ? 1 : bino(n - 1, k - 1) * n / k; } void work() { double dp[BUF]; dp[1] = 1; for (int i = 2; i <= n; ++i) { int sum = 0; for (int j = 1; j < i; ++j) for (int k = j + 1; k < i; ++k) { if (j == k) continue; sum += j * k; } dp[i] = dp[i - 1] + 2.0 / i + sum / (i == 2 ? 1 : bino(i - 1, 2)) * (i - 2) / i; } printf("%.10lf\n", dp[n]); } int main() { read(); work(); return 0; }