#BS0000065. Hóa đơn điện (Electric Bill)
Hóa đơn điện (Electric Bill)
Electric Bill
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
Electricity uses progressive rates: first 100 CWh cost 2 each, next 9900 cost 3 each, next 990000 cost 5 each, and the rest cost 7 each. Let be the bill for CWh. Given and , with and a unique solution, find .
Input
The only line contains .
Output
Print your bill .
Subtasks
- Subtask 1 — 20%: total consumption .
- Subtask 2 — 30%: total consumption .
- Subtask 3 — 50%: and the solution is unique.
Example
Input
1100 300
Output
350
Explanation
The combined consumption is 400 CWh; consumptions 150 and 250 produce bills 350 and 650.