MAIN113 - Special String

A string of letters X, Y, Z is special if there are three consecutive letters from which one is X, one is Y, and one is Z. For example, XYZXYZ is special, while XXYYZ is not. Your task is to calculate how many such strings of length n are not special.

Input

First line contains an integer T (1 <= T <= 30) which denotes the total number of test cases. Each test case contains an integer N (1 <= N <= 30) in a single line.

Output

For each test case print total number of strings which have a length N and are not special.

Example

Input:
1
2

Output:
9

Added by:amit karmakar
Date:2011-08-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2014-10-03 14:46:03 mayank
Did by DP :) . Unnecessary confusion can be avoided by adding "any" in place of blank in the statement "there is ___ three consecutive letters ", ie xxyz is a special string. Hope this helps.
2014-04-16 11:04:09 AlcatraZ
Nice problem.. 150th :)
2013-12-05 12:28:24 paras meena
Why Math... :(
2013-10-20 20:25:18 SYNTAX TERROR
Please give some more test cases.. problem is not clear.. In case of strings be a little more descriptive
2013-07-05 02:30:33 samuel
nice problem!
simple mathematic
2013-05-14 09:45:05 Parshant garg
is xyzx or xyyyyxyz is special?
xyz can be in any order?
or is whole string consist of xyz?
give more test cases?
2013-04-25 06:20:05 moustafa maher
@admin...plz post back the comment of akuya :D :D
2013-03-29 06:37:30 RAMAKRISHNAN.K
More testcases please..
2013-03-14 03:43:44 The Mundane Programmer
GOT AC , just easy one.....

Last edit: 2013-03-14 03:46:00
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.