import java.io.BufferedReader; import java.io.InputStreamReader; public class jeroenb { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static void main(String[] args) throws Exception { // Read input String number = in.readLine(); // Run a DP, with start index, prefix with '-' int n = number.length(); double[][] dp = new double[n+1][2]; for(int i = n - 1; i >= 0; i--) { for(int p = 0; p <= 1; p++) { double current = 0; double prob = p == 0 ? 1 : -1; for(int j = 0; i + j < n; j++) { current = current * 10 + (number.charAt(i+j) - '0'); // We get a + dp[i][p] += 0.45 * prob * (current + dp[i+j+1][0]); // We get a - dp[i][p] += 0.45 * prob * (current + dp[i+j+1][1]); // We get no + or - prob *= 0.1; } // End with a number dp[i][p] += prob * current; } } System.out.println(dp[0][0]); } }