Company: Algo university on campus_13april
Difficulty: medium
Maximum Withdrawal with Commission Fee You have a Passbook from CBI (Children Bank of India). The deposit passbook of this bank has an unusual feature that the commission fee varies based on the withdrawal amount. To withdraw money, you must specify the withdrawal amount in multiples of 1000 Rupees, and for each such 1000 Rupees withdrawn, you must pay a commission of C Rupees, in addition to the withdrawn amount. A withdrawal is not allowed if it would make the balance fall below 0 Rupees. Given that your current balance is R Rupees, determine the maximum amount of money you can withdraw from your account. Input Format: The first line contains two integers R and C — the current balance and the commission fee per 1000 Rupees withdrawn. 1 ≤ R ≤ 10 7 1 ≤ C ≤ 999 All input values are integers. Output Format: Print a single integer, the maximum amount of money that can be withdrawn from the account. Examples: Example 1: Input: 650000 8 Output: 644000 Example 2: Input: 100