# frozen_string_literal: true A, B, C = gets.split.map { _1.to_i } K = gets.to_i L = 10**9 + 7 def solve ((A * B * C) % L).pow(2.pow(K, L - 1), L) end puts solve