Filling Bucket
Submissions: 243   Accuracy:

32.93%

  Difficulty: Easy   Marks: 2

Given a Bucket having a capacity of N litres and the task is to determine that by how many ways you can fill it using two bottles of capacity of 1 Litre and 2 Litre only. Give the answer in Modulo 109.

Input
The first line contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of a single line containing  an integer N, where denotes the capacity of the Bucket.

Output
For each test case print in a new line the total number of ways in which the Bucket can be filled.

Constraints:
1 ≤T ≤500
1 ≤N ≤1000

Input


4

Output

5

Explanation
Let O denote filling by 1 litre bottle  and T denote filling by 2 litre bottle. So we have :
For N=3 {OOO,TO,OT} thus there are 3 total ways.
For N=4 {TT,OOOO,TOO,OTO,OOT} thus there are 5 total ways.

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

Contributor: Siddharth Dungarwal
Author: vaibhav2992


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.