No tag edit access

F. Bears and Juice

time limit per test

5 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThere are *n* bears in the inn and *p* places to sleep. Bears will party together for some number of nights (and days).

Bears love drinking juice. They don't like wine but they can't distinguish it from juice by taste or smell.

A bear doesn't sleep unless he drinks wine. A bear must go to sleep a few hours after drinking a wine. He will wake up many days after the party is over.

Radewoosh is the owner of the inn. He wants to put some number of barrels in front of bears. One barrel will contain wine and all other ones will contain juice. Radewoosh will challenge bears to find a barrel with wine.

Each night, the following happens in this exact order:

- Each bear must choose a (maybe empty) set of barrels. The same barrel may be chosen by many bears.
- Each bear drinks a glass from each barrel he chose.
- All bears who drink wine go to sleep (exactly those bears who chose a barrel with wine). They will wake up many days after the party is over. If there are not enough places to sleep then bears lose immediately.

At the end, if it's sure where wine is and there is at least one awake bear then bears win (unless they have lost before because of the number of places to sleep).

Radewoosh wants to allow bears to win. He considers *q* scenarios. In the *i*-th scenario the party will last for *i* nights. Then, let *R*_{i} denote the maximum number of barrels for which bears surely win if they behave optimally. Let's define . Your task is to find , where denotes the exclusive or (also denoted as XOR).

Note that the same barrel may be chosen by many bears and all of them will go to sleep at once.

Input

The only line of the input contains three integers *n*, *p* and *q* (1 ≤ *n* ≤ 10^{9}, 1 ≤ *p* ≤ 130, 1 ≤ *q* ≤ 2 000 000) — the number of bears, the number of places to sleep and the number of scenarios, respectively.

Output

Print one integer, equal to .

Examples

Input

5 1 3

Output

32

Input

1 100 4

Output

4

Input

3 2 1

Output

7

Input

100 100 100

Output

381863924

Note

In the first sample, there are 5 bears and only 1 place to sleep. We have *R*_{1} = 6, *R*_{2} = 11, *R*_{3} = 16 so the answer is . Let's analyze the optimal strategy for scenario with 2 days. There are *R*_{2} = 11 barrels and 10 of them contain juice.

- In the first night, the
*i*-th bear chooses a barrel*i*only.- If one of the first 5 barrels contains wine then one bear goes to sleep. Then, bears win because they know where wine is and there is at least one awake bear.
- But let's say none of the first 5 barrels contains wine. In the second night, the
*i*-th bear chooses a barrel 5 +*i*.- If one of barrels 6 – 10 contains wine then one bear goes to sleep. And again, bears win in such a situation.
- If nobody went to sleep then wine is in a barrel 11.

In the second sample, there is only one bear. He should choose an empty set of barrels in each night. Otherwise, he would maybe get wine and bears would lose (because there must be at least one awake bear). So, for any number of days we have *R*_{i} = 1. The answer is .

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/23/2017 19:42:53 (c2).

Desktop version, switch to mobile version.

User lists

Name |
---|