Just Add It#5493

Just Add It

1 second
128 megabytes
Very easy

For two given integers and find

(Z_n + Z_{n-1} - 2 \cdot Z_{n-2})~mod~10000007,

where

Z_n = S_n + P_n,
S_n = 1^k + 2^k + 3^k + ... + n^k,
P_n = 1^1 + 2^2 + 3^3 + ... + n^n

Input

There are several test cases. Each case is a separate line that contains two positive integers and k~(1 < n < 2 \cdot 10^8, 0 < k < 10^6). The last line contains two zeros and should not be processed.

Output

For each test case print the required value in a separate line.

Examples

Example 1

Loading
Loading