#B4150. Taxi Fare Calculation
Taxi Fare Calculation
Taxi Fare Calculation
In this problem, you are given an integer distance (in kilometers) representing the number of kilometers a taxi travels. The fare is calculated based on the following rules:
For \(d \leq 3\) km, the fare is a fixed 10 yuan.
For \(3 < d \leq 8\) km, the fare is 10 yuan for the first 3 km plus an additional 3 yuan for each kilometer beyond 3 km.
For \(d > 8\) km, the fare is calculated as 10 yuan for the first 3 km, plus 3 yuan for each kilometer from 4 km to 8 km, and 5 yuan for every kilometer beyond 8 km.
Formally, if \(d\) is the distance in kilometers, then the fare \(F(d)\) is given by:
\[ F(d)=\begin{cases} 10, & d\leq 3,\\ 10+3\times(d-3), & 38. \end{cases} \]
inputFormat
The input consists of a single integer which represents the distance traveled in kilometers.
outputFormat
Output a single integer representing the taxi fare in yuan.
sample
2
10