Splitting the Pizza Tower (Small)

A tower of N pizzas is repeatedly split into two smaller towers, each split scoring the product of the two new heights. Find the maximum total score (N ≤ 10).

Easy3Dynamic programmingMathGreedyInterviewNo attempts yetTime limit1sMemory limit512 MB

Problem

< Picture: Designed by Kstudio / Freepik >

Gap is a student at Ajou University. While preparing a department party on the first floor of Paldal Hall, he ordered NN pizzas. The delivered boxes sit on the table as a single tower. Gap has to break this tower of height NN into towers of height 1. He does not want to do it, but he remembers the line "if you can't avoid it, enjoy it" from Robert Eliot, so he turns the chore into the following game.

At the start of the game the table holds one tower of NN pizzas. Gap picks one tower from the table and splits it into two towers. If the two resulting towers have heights BB and CC, Gap feels B×CB \times C pleasure from that split. A tower of height 1 is never split again. Gap repeats this until no tower on the table can be split, and at that moment his preparation is done.

You are given the number of pizzas NN that Gap ordered. Find the maximum total pleasure Gap can feel.

< Splitting a tower of height 8 into two towers of height 4 >

Input

The first line contains a positive integer NN (1N101 \le N \le 10), the number of pizzas.

Output

Print the maximum total pleasure Gap can feel on one line.

Hint

When N=1N = 1 there is nothing to split from the start, so the total pleasure is 0.

Consider N=3N = 3. Each () is one tower and the number inside is its height. The table starts with (3). Gap splits (3) into (1) and (2) and feels 1×2=21 \times 2 = 2 pleasure. He then splits the tower of height 2, leaving (1), (1), (1) on the table, and feels 1×1=11 \times 1 = 1 more. No tower can be split now, so the total is 2+1=32 + 1 = 3.