atcoder#AGC022F. [AGC022F] Checkers

[AGC022F] Checkers

Score : 16001600 points

Problem Statement

Let X=10100X = 10^{100}. Inaba has NN checker pieces on the number line, where the ii-th checker piece is at coordinate XiX^{i} for all 1iN1 \leq i \leq N.

Every second, Inaba chooses two checker pieces, AA and BB, and move AA to the symmetric point of its current position with respect to BB. After that, BB is removed. (It is possible that AA and BB occupy the same position, and it is also possible for AA to occupy the same position as another checker piece after the move).

After N1N - 1 seconds, only one checker piece will remain. Find the number of distinct possible positions of that checker piece, modulo 109+710^{9} + 7.

Constraints

  • 1N501 \leq N \leq 50
  • NN is an integer.

Input

Input is given from Standard Input in the following format:

NN

Output

Print the number of distinct possible positions of the final checker piece, modulo 109+710^{9} + 7.

3
12

There are 33 checker pieces, positioned at 10100,10200,1030010^{100}, 10^{200}, 10^{300} respectively. Call them A,B,CA, B, C respectively.

Here are two (of the 1212) possible sequence of moves :

  • Let AA jump over BB in the first second, and let AA jump over CC in the second second. The final position of AA is 2×103002×10200+101002 \times 10^{300} - 2 \times 10^{200} + 10^{100}.
  • Let CC jump over AA in the first second, and let BB jump over CC in the second second. The final position of BB is 2×1030010200+4×10100-2 \times 10^{300} - 10^{200} + 4 \times 10^{100}.

There are a total of 3×2×2=123 \times 2 \times 2 = 12 possible sequence of moves, and the final piece are in different positions in all of them.

4
84
22
487772376

Remember to output your answer modulo 109+710^{9} + 7.