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