Consider a chessboard with n rows and n columns. In how many ways can we place n rooks so that at least two rooks threaten each other?
For instance, these are two of the ways for n = 6:
Input
Input consists of several numbers 1≤ n≤ 6. A special case with n = 0 marks the end of input.
Output
For every n, print the number of different ways to place n rooks on a chessboard n × n so that at least two rooks threaten each other. For every 1≤ n≤ 6, this number has less than 10 digits.
Input
2 3 0
Output
4 78