A **Padovan Sequence** is a sequence which is represented by the following recurrence

P(N) = P(N-2) + P(N-3)

P(0) = P(1) = P(2) = 1

Now given a number N your task is to find the N^{th} number in this sequence.

**Note:** Since the output could be very long take mod 1000000007

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each line contains an integer N.

**Output:**

For each test case, in a new line, print the nth no of the Padovan sequence.

**Constraints:**

1<=T<=100

1<=N<=100

**Example:
Input:**

2

12

4

21

2

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.

Vagesh Verma | 166 |

vamsikrishna55 | 162 |

UrGuru | 150 |

abducodes | 145 |

adithya_99 | 119 |

abducodes | 701 |

harshtyagi36 | 326 |

sandipbhaumik | 291 |

Akhil varma | 267 |

arpit_anshuman | 262 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.