Submit | All submissions | Best solutions | Back to list |
EIUPURCHASE3 - Installment Purchase 3 |
Tan is a manager of a mobile shop. The shop has imported many new products. Tan has to create detail payment plan for customer to pay in installment (Mua trả góp).
Installment purchase is popular payment method. For e.g. A Samsung Galaxy S20 Ultra has price of 19,990,000 vnd. Customer can buy the phone by pay 10,000,000 vnd now; pay 1,097,000 vnd each month in the next 12 months. Customer pay the same money every month.
Given the original price (P), the prepay money (M), the number of months that customer want to pay (N), and the expected monthly interest that the shop want (R). You have to write a program to help Tan calculate how much customer have to pay monthly.
Input
4 numbers in one line: the integer P (0 ≤ P ≤ 2*109), the integer M (0 ≤ M ≤ P), the integer N (1 ≤ N ≤ 48), and the double R (0 < R ≤ 0.1)
Output
The money which customer have to pay monthly (X). Result is rounded down to unit.
Sample
Input |
Output |
19990000 10000000 12 0.045 |
1095565 |
Added by: | Ha Minh Ngoc |
Date: | 2020-12-23 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |