import sequtils,strutils var P, K : int64 a0 = 1.int64 a1 = 0.int64 M = 1000000007.int64 (P, K) = stdin.readline.split.map(parseBiggestInt) for k in 1..K: var an : int64 = ((a0 * (P - 1) mod M) + (2.int64 * a1 * (P - 1)) mod M) mod M a0 = (a0 * (P + 1) mod M + a1 * 2 mod M) mod M a1 = an echo a0