# Bears and Juice

There 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:

1. Each bear must choose a (maybe empty) set of barrels. The same barrel may be chosen by many bears.
2. Each bear drinks a glass from each barrel he chose.
3. 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 np and q (1 ≤ n ≤ 109, 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 .

Solution:

#include <bits/stdc++.h>

using namespace std;

typedef unsigned int uint;

const uint phi = ((uint) 1) << ((uint) 31);

inline uint power(uint a, uint b) {
uint res = 1;
while (b > 0) {
if (b & 1) {
res *= a;
}
a *= a;
b >>= 1;
}
return res;
}

inline uint calc_C(int n, int k) {
if (k < 0 || k > n) {
return 0;
}
if (k > n - k) {
k = n - k;
}
uint x = 1;
int p2 = 0;
for (int i = n; i > n - k; i--) {
int tmp = i;
while (!(tmp & 1)) {
p2++;
tmp >>= 1;
}
x *= tmp;
}
uint y = 1;
for (int i = k; i > 0; i--) {
int tmp = i;
while (!(tmp & 1)) {
p2--;
tmp >>= 1;
}
y *= tmp;
}
x *= power(y, phi - 1);
while (p2 > 0) {
x *= 2;
p2--;
}
return x;
}

const int P = 144;

uint C[P][P];
uint f[P][P];
uint smallC[P];

int main() {
int n, p, q;
scanf("%d %d %d", &n, &p, &q);
p = min(p, n - 1);
for (int d = 0; d <= p; d++) {
for (int t = 0; t <= p - d; t++) {
C[d][t] = calc_C(n - d, t);
}
}
for (int d = 0; d <= p; d++) {
f[0][d] = 1;
}
for (int i = 1; i <= p; i++) {
for (int d = 0; d <= p; d++) {
f[i][d] = 0;
for (int t = 1; t <= p - d; t++) {
f[i][d] += C[d][t] * f[i - 1][d + t];
}
}
}
for (int j = 0; j <= p; j++) {
smallC[j] = (j == 0 ? 1 : 0);
}
uint res = 0;
for (int i = 1; i <= q; i++) {
uint ans = 1;
for (int j = p; j >= 1; j--) {
smallC[j] += smallC[j - 1];
ans += f[j][0] * smallC[j];
}
res ^= ((uint) i) * ((uint) ans);
}
cout << res << endl;
return 0;
}