def ft_pow(nb, n): if n == 0: return 1 tmp = ft_pow(nb, n/2) if n % 2 == 0: return (tmp * tmp) % 1000000007 else: if n > 0: return (nb * tmp * tmp) % 1000000007 else: return (tmp * tmp / nb) % 1000000007 a,b,t = [int(x) for x in raw_input().split(' ')] cnt = 1 k = (a + b) / 2 print ft_pow(k,t)