Company: Algo university on campus_13april
Difficulty: medium
Maximum Withdrawal with Commission Fee Suppose you hold a savings passbook from CBI (Children Bank of India), a bank whose commission fee structure has an unusual quirk: the fee scales with how much you withdraw. Withdrawals must be requested in multiples of 1000 Rupees, and every such 1000-Rupee chunk withdrawn costs a commission of C Rupees on top of the amount taken out. A withdrawal is rejected outright if it would push the balance below 0 Rupees. Given a current balance of R Rupees, work out the largest amount that can be withdrawn. 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: 1003 4 Output: 0 Note: The commission fee required to withdraw Rupees 644,