BETA

Difficulty Level:

Basic

Total Submissions: 1268 Accuracy:

47.4%

Total number of Strings
       

Given 3 characters a, b, c. Find the number of strings of length n that can be formed from these 3 characters. Given that : we can use ‘a’ as many times as we want, ‘b’ maximum once, and ‘c’ maximum twice.

Input:
The first line of input contains an integer T denoting the number of test cases. The first and last line of each test case consists of an integer n

Output:
Print the total number of string that can be formed.

Constraints: 
1<=T<=20
1<=N<=20

Example:
Input:

2
3
5

Output:
19
71 

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

Contributor: Saksham Ashtputre

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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