Scanner sc = new Scanner(System.in) int a = sc.nextInt() int b = sc.nextInt() long t = sc.nextLong() // v_(i+1) = 0.5*v_i*(a+b) BigInteger result; //if((a+b)%2 == 0){ int m = (a+b)/2 result = m result = result.modPow(t, ((10**9)+7)) //} else{ // throw new Exception("it is guaranteed that expected value is integer"); //} println result