Pizzas
InterviewTime limit1sMemory limit1024 MB
Given N riders, M showers, T minutes per shower, and a budget K, find the total pizza money left after each rider's shower-line wait is subtracted.
- Level
Easy3 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Organizing a cycling competition requires two things: showers and pizza.
Riders go straight to the showers when they finish, and buy pizza after showering. Sometimes there are not enough showers for everyone, so riders wait in line.
While waiting, riders eat snacks. If a rider originally planned to spend euros on pizza and waited minutes in the shower line, the rider spends euros on pizza. If the wait is too long and , the rider buys no pizza.
The organizers set up showers. riders take part, and each rider spends minutes in a shower. Each rider originally plans to spend euros on snacks.
Calculate how many euros the organizers earn from selling pizza.
Input
The input is a single line with four integers , , , and , separated by spaces.
Output
Print one integer: the number of euros the organizers earn from selling pizza.
Constraints
- The answer for every test does not exceed 2000000000.