In the grand kitchen of the Culinary Academy of Computable Cuisine, Chef Turing is preparing for the most important banquet of the year. The recipes are not written in ordinary ink; they are algorithms, and every dish must be calculated to exacting standards. A Loop Lord sous-chef has been called upon to solve the recipe titled "Nth Pentagonal Number — Level 4". Pots clang and timers beep as the head chef explains the dish. The reputation of the academy hangs in the balance, and the diners — kings, queens, and quantum physicists — will accept no imperfection. Read a positive integer n and print the nth pentagonal number. The recipe card specifies these strict constraints, for a souffle falls if the ratios are wrong: 1 <= n <= 10^9 For the taste test, these sample servings have been prepared: Input: 5 Output: 35 The banquet begins in one hour. Steam fills the kitchen, and Chef Turing's gaze is unforgiving. Prepare a solution that is precise, efficient, and deliciously correct. One wrong byte, and the whole meal could collapse. The path to mastering Nth Pentagonal Number — Level 4 is not one that can be walked in a single step. It demands patience, precision, and a deep respect for the boundaries that shape the problem. Many adventurers before you have attempted this trial and failed, their code crashing against the very constraints that the elders inscribed. But you have the tools. You have the training. You have reached the Loop Lord tier, and that alone means the council believes in your potential. Look once more at the examples above. Trace the logic with your finger if you must. Consider the time and memory limits carefully, for they are not suggestions but strict laws of the arena. When you are ready, commit your solution. Let the compiler run. Let the test cases judge your work. If your code is true, the gates will open and you will move closer to the ultimate rank. If not, study the failure, sharpen your algorithm, and try again. For in the halls of CodeTikki, the only thing more important than success is the wisdom gained from the attempt. Remember that the Loop Lord challenge is designed to test not just knowledge, but character. Every edge case is a lesson. Every time limit is a teacher. Every hidden test is a guardian at the gate. Do not rush. Let your code breathe. Let it be as clean as a mountain stream. When the final test passes, you will know that you have earned the title. Until then, code with courage, test with care, and never stop learning.
Constraints:
1 <= n <= 10^9
