Filling Bucket
Easy Accuracy: 31.47% Submissions: 283 Points: 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

Example:
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.

to report an issue on this page.

Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes

All Submissions

My Submissions:

Login to access your submissions.