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.
- A single line containing five integers x,a,b,c,d.
Output
- Print a single integer representing the total electricity cost.
Constraints
Example
Input:
60 1 2 3 4
Output:
70