We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

Loading...

- All Contests
- ProjectEuler+
- Project Euler #162: Hexadecimal numbers

# Project Euler #162: Hexadecimal numbers

# Project Euler #162: Hexadecimal numbers

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

In the hexadecimal number system numbers are represented using different digits:

The hexadecimal number AF when written in the decimal number system equals .

In the hexadecimal numbers and the digits and are all present.

Like numbers written in base ten we write hexadecimal numbers without leading zeroes.

How many hexadecimal numbers containing at most hexadecimal digits exist with all of the digits and present at least once?

Give your answer modulo .

**Input Format**

The first line contains an integer, .

**Constraints**

**Output Format**

Print the answer modulo .

**Sample Input**

```
3
```

**Sample Output**

```
4
```