SP23963 EASYFACT - Easy Factorials

Description

Finding factorials are easy but they become large quickly that is why Lucky hate factorials. Today he have another task related to factorials. For a given number n how many ways factorial n can expressed as a sum of two or more consecutive positive integers. Can you help lucky ?

Input Format

First line contains single integer T < 5001, next T lines followed by an integer N where M is a prime number.

Output Format

Print the desired result mod M.