Total cost
Practice
3.6 (67 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
80% Success 16042 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

A family consists of \(x\) members. You are given the task to book flight tickets for these \(x\) members.
You are given the following information about the airline in which you have to book the tickets:

  • \(P\): It denotes the cost of one ticket of the flight.
  • \(S\): It denotes the number of total available seats in the flight.
  • \(T\): If the numbers of available seats are less than or equal to \(T\), then the cost of the flight ticket increases to \(H\).
  • \(H\): It denotes the new hiked cost.

Determine the total cost to book the tickets for all the family members.

Note: The tickets are booked one by one for all the family members.

Input format

First line: Five space-separated integers \(P,S,T,H,\) and \(x\) respectively

Output format

Print the total cost to book the tickets for all the members of the family.

Constraints

\(1 \le P \le H \le 10^5\)

\(1 \le S \le 300\)

\(1 \le T \le S\)

\(1 \le x \le S\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
16 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation
Points:20
25 votes
Tags:
Basic ProgrammingC++
Points:20
38 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyImplementation