Taxicabs in New York City have a complicated fare structure:
- $2.50 for the first unit or fraction thereof if there is less than one total unit.
- $0.40 for each additional unit, where a unit is defined as:
- 1/5 of a mile, when the taxicab is traveling at 6 miles an hour or more, or
- 60 seconds, when the taxicab is traveling at less than 6 miles an hour.
You will be given the number of blocks the cab travels each minute and you are to calculate the total fare in dollars and cents. (There are 20 blocks in a mile.) You may assume that the taxi's speed is constant during each minute. Note that the number of units accumulated during a minute may not be an integer.
Return the total fare as a String (without a dollar sign), with exactly two digits to the right of the decimal point and no extraneous leading zeros. |