use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let k: usize = itr.next().unwrap().parse().unwrap(); // dp[i<0] = dp[k], ループするのでこれを固定する let mut dp: Vec = vec![0.0; k + 5]; let mut l = 0.0; let mut r = 1000.0; for _ in 0..1000 { let mid = (l + r) / 2.0; dp[0] = 0.0; for i in 1..k + 1 { dp[i] = 1.0; for j in 1..7 { if i < j { dp[i] += mid / 6.0; } else { dp[i] += dp[i - j] / 6.0; } } } if dp[k] > mid { l = mid; } else { r = mid; } } println!("{:.10}", dp[k]); }