Financial Freedom

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Mr. Tan aims to earn X VND before retiring. Upon retirement, he plans to put the entire X VND into a safe investment with a stable monthly return of r%. At the end of the first month, he plans to withdraw Y VND for expenses. Due to the impact of inflation with an monthly rate of f%, in the following months, he will withdraw an amount of money that ensures a standard of living equivalent to the Y VND from the first month of retirement. Mr. Tan wants to ensure that he has enough money to spend for at least N months (i.e. Mr. Tan withdraws N-1 times).

Input

The only line contain 2 real numbers r and f, and 2 integers Y and N

Output

Calculate X (rounded to 4 decimal places)

Example

Input
0.6 0.25 20 400
Output
4291.8397

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.