a, b, c = map(int, input().split()) k = int(input()) print(((a*b*c)%(10**9+7)) ** ((2**k)%(10**9+6))%(10**9+7))