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 scanner = new Scanner(System.in); BigInteger a = scanner.nextBigInteger(); BigInteger b = scanner.nextBigInteger(); BigInteger t = scanner.nextBigInteger(); BigInteger divide = new BigInteger("2"); BigInteger num = new BigInteger("10"); BigInteger growthRate = a.add(b).divide(divide); BigInteger constant = new BigInteger("7"); BigInteger modulo = num.pow(9).add(constant); BigInteger totalViruses = growthRate.modPow(t, modulo); System.out.println(Integer.parseInt(totalViruses.toString())); scanner.close(); } }