All Tracks Problem

Alice and her sequence
Tag(s):

Algorithms, Easy-Medium, Math

Problem
Editorial
Analytics

Alice is very fond of Sequences. But she got stuck in a problem. She wants to generate sequences of length $$N$$ , consisting only of numbers $$1,2,3$$ In any sequence each number occurs at least once.

So, she wants your help now to compute this. She has been given $$N$$ , the length of the sequences she needs to generate. You need to help her, and find out how many such sequences exist. Can you do it ?

The number is so large so you need to compute answer modulo $$1000000007$$ .

Input Format :

The first line contains a single integer $$T$$ denoting the number of test cases. Each of the next $$T$$ lines contains a single integer $$N$$, denoting the parameter of the $$i^{th}$$ test.

Output Format :

You have to print the number of sequences of length $$N$$ that consists of at least one occurence of each of $$1$$, $$2$$ and $$3$$. As the answer can be rather large, print it modulo $$10^9+7$$.

Constraints

$$ 1 \le T \le 100 $$

$$ 1 \le N \le 10^6 $$

SAMPLE INPUT
 5
 1
 2
 3
 4
 5
SAMPLE OUTPUT
0
0
6
36
150
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Accolite

Challenge Name

Accolite Java Developer Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications