import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner scan = new Scanner(System.in); int a = scan.nextInt(); int b = scan.nextInt(); long t = scan.nextLong(); int virus = (a + b) / 2; int modul = (int)Math.pow(10, 9) + 7; //long res = (long) power(virus, t, modul); int res = modulo(virus, t, modul); System.out.println(res); } static int modulo(int a,long b,int c) { long x=1; long y=a; while(b > 0){ if(b%2 == 1L){ x=(x*y)%c; } y = (y*y)%c; // squaring the base b /= 2; } return (int) x%c; } }