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