- All Contests
- ProjectEuler+
- Project Euler #116: Red, green or blue tiles

# Project Euler #116: Red, green or blue tiles

# Project Euler #116: Red, green or blue tiles

_{This problem is a programming version of Problem 116 from projecteuler.net}

A row of five black square tiles is to have a number of its tiles replaced with coloured oblong tiles chosen from red (length two), green (length three), or blue (length four).

If red tiles are chosen there are exactly seven ways this can be done.

If green tiles are chosen there are three ways.

And if blue tiles are chosen there are two ways.

Assuming that colours cannot be mixed there are ways of replacing the black tiles in a row measuring five units in length.

How many different ways can the black tiles in a row measuring units in length be replaced if colours cannot be mixed and at least one coloured tile must be used?

As the answer can be extremely large, print it modulo .

**Input Format**

First line contains an integer denoting the number of test cases.

Each of the following lines contain one integer .

**Constraints**

**Output Format**

For each of test cases print one line containing a single integer - the answer to a problem modulo .

**Sample Input**

```
1
5
```

**Sample Output**

```
12
```