Problem Archive

v1.0.0

My personal problemset archive! Try out some fun puzzles!!!


> A Very Big Power

Time: 1000 ms | Memory: 262144 KB

*500

Math


Given two integers x and y, compute xy modulo 1,000,000,007 (that is, 109 + 7).


Input

A single line containing two space-separated integers x (0 ≤ x ≤ 1018) and y (0 ≤ y ≤ 1018).


Output

A single integer xy mod(109 + 7).


Note

  • Subtask 1 (20 pts): 1 ≤ x and y ≤ 106.
  • Subtask 2 (30 pts): 1 ≤ x (no bound on y beyond the above).
  • Subtask 3 (50 pts): no additional constraints.

Example


Input 1
2 3
Output 1
8

> [Submit Solution]