#P3197. [HNOI2008] 越狱

    ID: 2246 远端评测题 1000ms 125MiB 尝试: 7 已通过: 4 难度: 5 上传者: 标签>数学2008各省省选湖南O2优化组合数学容斥

[HNOI2008] 越狱

Description

There are nn rooms in the prison, with one prisoner in each room. There are mm religions, and each prisoner believes in exactly one of them. If prisoners in adjacent rooms have the same religion, a prison break may occur. Count how many states may lead to a prison break.

Output the answer modulo 100,003100{,}003.

Input Format

The input contains a single line with two integers, the number of religions mm and the number of rooms nn.

Output Format

Output a single integer on one line representing the answer.

2 3

6

Hint

Sample Input/Output 1 Explanation

State ID Room 1 Room 2 Room 3
1 Religion 1 Religion 1 Religion 1
2 Religion 2
3 Religion 2
4 Religion 2 Religion 1
5 Religion 2 Religion 2
6 Religion 1

Constraints

For 100%100\% of the testdata, it is guaranteed that 1m1081 \le m \le 10^8, 1n10121 \le n \le 10^{12}.

Translated by ChatGPT 5