a, b, t = gets.strip.split(' ').map(&:to_i) f = (a + b) / 2 m = 10 ** 9 + 7 arr = [] loop do q = Math.log(m, f).floor + 1 r = (f ** q).modulo(m) arr << f ** t.modulo(q) t /= q break if t == 0 f = r end puts arr.reduce(1, &:*).modulo(m)