Calculate the Power

3.7

54 votes
Algorithms, Approved, Easy, Open
Problem

Given two number A and B. Calculate the value of AB. Output may be too large so print the answer modulo 10^9+7.

Input:
Input contains two integers A and B separated by space.

Output:
Print value of AB modulo 10^9+7.

Constraints:
Test File 1 to 5:
1<=A<=10
1<=B<=10

Test File 6 to 10:
1<=A<=106
1<=B<=1010

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?