import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static double mutate(double cells, int t, int a, int b) { if (t == 0) { return cells; } return mutate(cells * a * 0.5, t - 1, a, b) + mutate(cells * b * 0.5, t - 1, a, b); } public static void main(String[] args) { Scanner in = new Scanner(System.in); int a = in.nextInt(); int b = in.nextInt(); int t = in.nextInt(); double cells = mutate(1.0d, t, a, b); System.out.println(((long)cells) % (long)(Math.pow(10, 9) + 7)); } }