package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int value = scanner.nextInt(); double left = 0; double right = 1e10; double middle = (left + right) / 2.0; for(int i = 0 ; i < 200;i++) { double[] dp = new double[value+1]; middle = (left + right) / 2.0; for(int k = value-1;k >= 0;k--) { double sum = 1; for(int m = 1;m <=6;m++) { if(k + m > value) { sum += middle / 6.0; } else { sum += dp[k+m] / 6.0; } } dp[k] = sum; } if(dp[0] < middle) { right = middle; } else { left = middle; } } System.out.println(middle); } }