A Mad Tea Party#719

A Mad Tea Party

1 second
64 megabytes
Medium

Time won't budge now! The clock is always at half-past five... It's always tea time here, and the dishes never get washed!

– Here's the plan, said the March Hare, we'll prepare large servings of tea. Each serving consists of cups arranged in a row. We'll pour green tea into some cups, but never into two consecutive cups. The other cups will contain classic English black tea.

– I wonder how many different servings we can create? asked the Dormouse, waking up briefly before dozing off again.

– As many as possible, that's how many we'll make! exclaimed the Hatter. Then we'll raise some number to that power and drink it.

– Wow! And what kind of number will that be and what will we toast to? yawned the Dormouse, waking up once more.

– A number is just a number, simply enormous, too big to count. But it doesn't matter, you can calculate it modulo some number ! Alice mused aloud.

Input

The input file contains three natural numbers , , and . All numbers do not exceed 10^9.

Output

Output a single number — the answer.

Examples

Example 1

Loading
Loading