아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Crashing Competition Computer

시간 제한4초메모리 제한1024 MB

요약
글자를 칠 때마다 컴퓨터가 멈출 수 있고 저장 지점에서 다시 시작할 수 있을 때, c개의 글자를 모두 입력하는 데 걸리는 기대 시간을 구한다.
난이도

보통10점 중 7점

유형
동적 계획법, 확률, 수학
정답자
아직 제출이 없습니다

문제

You are writing code for a hackathon where you need to decode Binary ALGOL Punch Cards. You have already come up with the optimal solution and only need to type it out. The solution consists of cc characters, and your typing speed is 11 character per time unit. However, your computer is prone to sudden crashes: after every character you type there is a probability of pp that your computer crashes and you need to start over again. Recovering after a crash costs rr time units, and you can then continue typing from the last point where you saved your code.

You can click "Save" at any time (which costs tt time units) to save your code and to be able to restart from this point after crashes. Clicking "Save" will not cause your computer to crash.

Determine how many (expected) time units you need to complete the code. Note that the code should be saved after typing the last character.

입력

The input consists of:

  • One line with three integers cc, tt, and rr (1≤c≤20001 \leq c \leq 2000, 0≤t,r≤1090 \leq t, r \leq 10^9), indicating the number of characters, the time cost of clicking "Save", and the time cost of recovering after a crash.
  • One line with a floating-point number pp (0.001≤p≤0.9990.001 \leq p \leq 0.999, with at most 1010 digits after the decimal point), the probability that your computer crashes after a character press.

출력

Output the expected number of time units you need to complete the code.

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

예제3

  1. 예제 1

    입력
    2 1 5
    0.25
    
    예상 출력
    8.0
    
  2. 예제 2

    입력
    3 5 2
    0.5
    
    예상 출력
    26.0
    
  3. 예제 3

    입력
    10 4 5
    0.327
    
    예상 출력
    68.664967357