def search(n, bits, k, i)
	return 1 if k == 0
	return 0 if bits[0] == 1
	tuple = [bits, k, i]
	cache = $memo[tuple]
	return cache if cache
	sum = 0
	(i..n-1).each{|j|
		next if bits[j-i] == 1
		copy = bits
		copy |= (1 << j-i+1) if j < n-1
		copy |= (1 << j-i+n/2) if n.even? && j < n/2
		sum += search(n, copy>>(j-i)+2, k-1, j+2)
	}
	$memo[tuple] = sum
end

loop {
	n = gets.to_i
	break if n == 0
	bits = 0
	bits |= 2
	bits |= (1 << n-1)
	bits |= (1 << n/2) if n.even?
	
	$memo = {}
	p search(n, bits>>2, 7, 2) * n * 5040
}