問題一覧 > 通常問題

No.1578 A × B × C

レベル : / AI推定難易度 : 1000 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 240
作問者 : magsta / テスター : 👑 Kazun
お気に入りにしたユーザー ProblemId : 6405 / 自分の提出
問題文最終更新日: 2021-07-01 17:17:44
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 302 (順位表) の他の問題:

Problem Statement

You are given 3 positive integers $A, B, C$ and a positive integer $K$. Initially, the 3 numbers $A, B, C$ are written on a blackboard.

Perform the following operation $K$ times.

  • Simultaneously rewrite each of the 3 numbers written on the blackboard with the product of the other 2 numbers.

Find the product of the 3 numbers written on the blackboard after the operations are finished, modulo $10^9+7$.

Hint: Fermat's little theorem (opens Wikipedia)

Input

$A\ \ B\ \ C$
$K$

  • $1 \leq A, B, C \leq 10^9$
  • $1 \leq K \leq 10^{12}$
  • All inputs are integers.

Output

Output the value you found, followed by a newline.

Sample

Sample 1
Input
2 3 1
1
Output
36

The numbers written on the blackboard become $3,\ 2,\ 6$, and their product $36$ is the answer.

Sample 2
Input
1 1 1
4879314
Output
1

No matter how many times the operation is performed, the numbers remain $1,\ 1,\ 1$.

Sample 3
Input
390421437 291872136 531083427
292874319324
Output
664210506

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。