~/algor $ cat problems/kombinatorika-parollar-soni
Number of passwords
Easy
1000 ms
128 MB
23%
A password is exactly $n$ characters long. Each character is one of $k$ letters or one of $m$ digits (letters and digits are different characters). The password must contain at least one digit. How many different passwords can be made? Print the answer modulo $10^{9} + 7$.
Input
One line with three positive integers: $n$, $k$ and $m$.
Output
One integer — the number of passwords modulo $10^{9} + 7$.
Note
$1 \le n \le 10^{18}$
$1 \le k, m \le 10^{9}$
Examples
Input #1
2 3 2
Output #1
16
Input #2
1 5 1
Output #2
1