All Tracks Math Number Theory Basic Number Theory-1 Problem

Rhezo and Big Powers
Tag(s):

Easy-Medium, Math, Number Theory

Problem
Editorial
Analytics

Rhezo likes numbers of the form \(A^B\). But computing \(A^B\), for any 2 numbers A and B is a hard task for him. He would like you to help him out in this.

Input:
First line of input contains a single integer A. Second line contains the integer B.

Output:
Help Rhezo find \(A^B\). As this number can be large, print it modulo \(10^9+7\).

Constraints:

  • \( 1 \le A \le 10^9 \)
  • \( 1 \le B \le 10^{10^5} \)
SAMPLE INPUT
4
3
SAMPLE OUTPUT
64
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

Happay

Challenge Name

Happay Hiring Challenge

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications

?