#K46512. Delivery Cost Calculation

    ID: 27993 Type: Default 1000ms 256MiB

Delivery Cost Calculation

Delivery Cost Calculation

You are given the weight and distance for a package delivery. The cost to send the package is calculated based on different pricing schemes for weight and distance.

Weight Cost:

  • If the weight (in kg) is less than or equal to 1, the cost is \(5 \times \text{weight}\).
  • If the weight is more than 1 but less than or equal to 5, the cost is \(3 \times \text{weight}\).
  • If the weight is more than 5, the cost is \(2 \times \text{weight}\).

Distance Cost:

  • If the distance (in km) is less than or equal to 100, the cost is \(0.5 \times \text{distance}\).
  • If the distance is more than 100 but less than or equal to 1000, the cost is \(0.3 \times \text{distance}\).
  • If the distance is more than 1000, the cost is \(0.2 \times \text{distance}\).

The total cost is the sum of the weight cost and the distance cost. Your task is to compute and output the total cost given the weight and distance values. All arithmetic operations should be done in floating point arithmetic.

inputFormat

The input consists of two integers separated by space. The first integer represents the weight of the package in kilograms and the second integer represents the distance in kilometers.

outputFormat

Output a single floating point number (with one decimal place if necessary) representing the total cost to deliver the package.## sample

2 150
51.0