Paint Wall
Practice
4.1 (8 votes)
Basic programming
Mathematics
Open
Approved
Easy
Mathamatics
Problem
32% Success 4874 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

Bob got a new contract of painting wall. Wall has N bricks. Bob can paint each brick with three type of colors : Type A, Type B and Type C. Assume Bob has enough amount of paints of all three types. Find number of ways Bob can paint the wall having N bricks with color of Type A, Type B and Type C such that no two adjacent brick should have same color.

Input:

First line of input contains number of test cases T. Each test case contains a single integer N, number of bricks in wall.

Output:

For each test case print the number of ways Bob can paint the wall. Answer can be too large print answer modulo 109+7.

Constraints:
1 ≤ T ≤ 103
1 ≤ N ≤ 105

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
1 votes
Tags:
Easy
Points:20
22 votes
Tags:
Easy
Points:20
Tags:
Easy