a, b, c = map(int, input().split()) k = int(input()) m = pow(10, 9) + 7 mod = pow(2, k, m - 1) ans = a*b*c print(pow(ans, mod, m))