Electricity bill - MarisaOJ: Marisa Online Judge

Electricity bill

Time limit: 1000 ms
Memory limit: 256 MB
Monthly electricity cost is calculated using the following rates: - From kWh $0$ to $50$: $a$ units. - From kWh $51$ to $100$: $b$ units. - From kWh $101$ to $150$: $c$ units. - From kWh $151$ and above: $d$ units. Given the number of kWh used as $x$ and four integers $a, b, c, d$, calculate the electricity cost. ### Input - A single line containing five integers $x, a, b, c, d$. ### Output - Print a single integer representing the total electricity cost. ### Constraints - $1 \le x, a, b, c, d \le 1000$. ### Example Input: ``` 60 1 2 3 4 ``` Output: ``` 70 ```