Problem D
House of Cards
The house will have a triangular shape. The illustration to the right shows a house of height $6$, and Figure 1 shows a schematic figure of a house of height $5$.
For aesthetic reasons, the cards used to build the tower should feature each of the four suits (clubs, diamonds, hearts, spades) equally often. Depending on the height of the tower, this may or may not be possible. Given a lower bound $h_0$ on the height of the tower, what is the smallest possible height $h \ge h_0$ such that it is possible to build the tower?
Input
A single integer $1 \le h_0 \le 10^{1000}$, the minimum height of the tower.
Output
An integer, the smallest $h \ge h_0$ such that it is possible to build a tower of height $h$.
Sample Input 1 | Sample Output 1 |
---|---|
2 |
5 |
Sample Input 2 | Sample Output 2 |
---|---|
42 |
45 |