You have a strip of cells, numbered from to . Initially, all cells are uncolored.
There are painting instructions. Instruction paints cells through with color , overwriting their previous colors.
You must execute every instruction exactly once, in any order you choose.
How many different final colorings can you obtain? Output the answer modulo .
Two colorings are different if at least one cell has a different color.
For each test case, output the number of different final colorings modulo on a separate line.