Type: Default 1000ms 256MiB

越狱

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

监狱有连续编号为 11nnnn 个房间,每个房间关押一个犯人。有 mm 种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人信仰的宗教相同,就可能发生越狱。求有多少种状态可能发生越狱。

Input Format

输入两个整数 mmnn

Output Format

可能越狱的状态数,对 100003100003 取余。

2 3
6

Hint

【提示】样例说明

所有可能的 6种状态为:$\{0,0,0\},\{0,0,1\},\{0,1,1\},\{1,0,0\},\{1,1,0\},\{1,1,1\}$。

数据范围与提示:对于全部数据,1m108,1n10121≤m≤10^8 ,1≤n≤10^{12}

Source

zoj http://hdnoip.com