B,C,D=map(int,input().split()) ka=0 for i in range(D): ka+=B ka*=C print(ka%1000000007)