Back
Close

Paint, Inc.

Statement
You're an interior painter tasked by Paint, Inc. to paint a house with [[R]] rooms. For each room there are four walls and one ceiling, which all have the same dimensions and need [[C]] coats of paint. You can't paint the next coat until the previous one has dried. You're finished when every wall is dry. Time taken to move between walls, ceilings, rooms is negligible. It takes you [[M1]] minutes to paint each coat, and [[M2]] minutes for the paint to dry on each. You must finish in the least possible time, otherwise they will not pay you. {{NOTE}} DON'T FORGET, THE PAINT MUST ALL BE DRY BEFORE YOU CAN RECEIVE YOUR PAYMENT!

Input description
<<Line 1>>: [[R]], [[C]], [[M1]], [[M2]] separated by spaces. [[R]]: Number of rooms in the house [[C]]: Coats of paint needed for each wall/ceiling [[M1]]: Minutes taken to paint each coat [[M2]]: Minutes taken for paint to dry on each coat (measured from when you've finished the entire coat)

Output description
The time taken to paint the entire house in the format {{H:MM}}

Constraints
1 ≤ [[R]] ≤ 10 1 ≤ [[C]] ≤ 20 1 ≤ [[M1]] ≤ 10000 1 ≤ [[M2]] ≤ 10000

Game modes

Test cases
Hot day Test
Input
1 1 12 0
Output
1:00

Validator 1 Validator
Input
2 2 14 0
Output
4:40

Wait for it Test
Input
5 2 5 30
Output
4:40

Validator 2 Validator
Input
3 3 10 20
Output
7:50

Extremely wet paint Test
Input
1 5 5 200
Output
17:25

Validator 3 Validator
Input
2 3 1 196
Output
10:00

We hired Clark Kent Test
Input
1 5 1 60
Output
5:09

Validator 4 Validator
Input
9 12 4 1200
Output
243:44

Solution language

Solution

Stub generator input