#K12591. Tax Calculation Challenge

    ID: 23724 Type: Default 1000ms 256MiB

Tax Calculation Challenge

Tax Calculation Challenge

You are given an annual income in yen. Your task is to compute the total tax based on the following tiered rules:

  • No tax is applied on the first 1000 yen.
  • A tax rate of 10% is applied on the portion of the income from 1001 to 5000 yen. In mathematical terms, if \(I\) is the income and \(1000 < I \le 5000\), then the tax is computed as \((I - 1000) \times 0.1\).
  • A tax rate of 20% is applied on the portion of the income above 5000 yen. That is, if \(I > 5000\), then the tax is \(400 + (I - 5000) \times 0.2\), where \(400\) is the tax for the income between 1001 and 5000 yen (since \(4000 \times 0.1 = 400\)).

Your program should read a single integer from standard input and output a single integer representing the calculated tax.

inputFormat

A single integer representing the annual income in yen.

outputFormat

A single integer representing the total tax computed according to the specified rules.## sample

1000
0