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. */ double a,b,t,virus=1; Scanner scan = new Scanner(System.in); a = scan.nextDouble(); b = scan.nextDouble(); t = scan.nextDouble(); for(float i=1;i<=t;i++){ virus = a*virus*0.5 + b*virus*0.5; } virus = virus%(java.lang.Math.pow(10,9)+7); System.out.println((int)virus); } }