PivotOJ

Accidental Arithmetic

시간 제한: 1000ms메모리 제한: 2048MB출처: BAPC 2025BOJ 35204

문제

It is the 25th of January, 2025. You are working on your final report for the statistics class. However, when you enter the calculations into your trusted Brittle Arithmetic Portable Calculator, you notice that the + and - buttons have malfunctioned. Whenever you press a numeric button (a button from 0 through 9), an additional button press may be registered immediately after: either the + button, or the - button, or neither (but never both). "Ugh," you think to yourself, "why did I not buy a Backup Arithmetic Portable Calculator..." But then you get an idea to save yourself from getting a low grade.

After some experimentation, you statistically determined that pressing a numeric button results in an additional + input 45%45\% of the time, and the same holds for the - button (and never both at the same time). You decide that you should write your report about your findings. In addition to statistical analysis, the teacher requires you to perform some probabilistic predictions based on a statistical model. You decide to investigate what your calculator does when you try to simply input a natural number.

Given a natural number nn, you consider entering the number into the calculator by pressing the numeric buttons corresponding to the standard base 1010 representation of nn. The calculator may register a + or - button press in between the digits of nn, which results in an arithmetic expression. You wonder what happens if you press = to evaluate the expression. Luckily, if your expression ends with a + or -, the calculator ignores this, such that this evaluation always results in an integer. To finish your report, you decide to write a program that determines the expected value of this result for any given value of nn.

입력

The input consists of:

  • One line with an integer nn (0n<1010000 \leq n < 10^{1000}), the number that you will enter into the calculator.

출력

Output the expected value of the result.

Your answer should have an absolute or relative error of at most 10610^{-6}.

예제

예제 1

입력
12345
출력
5.4321

예제 2

입력
777777
출력
42

예제 3

입력
31415926535897932384626433832795028841971693993751
출력
141.5189
코드를 제출하려면 로그인하세요.