A, B, C = map(int,input().split()) K = int(input()) for _ in range(K): A, B, C = B * C % 1000000007, A * C % 1000000007, A * B % 1000000007 print(A * B * C % 1000000007)