Three Number Even Sum
Submissions: 784   Accuracy:

15.09%

  Difficulty: Easy   Marks: 2

Given an integer N, find the number of ways we can choose 3 numbers from {1,2,3…,N} such that their sum is even.

Input:
The first line of the test case contains an integer T denoting number of test cases. Following T line contains an integer N each.

Output:
Print the answer under modulo 109+7.

Constraints:

1 <= T <= 100
3 <= N <= 106

Example:-
Input:
2
3
4
Output:
1
2

Explanation:
Testcase 1:
For N=3 the only possible combination is {1,2,3}.So, the output is 1.

** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.