Back
Close

Last digit of powered number

Statement

 Goal

Write last digit of number raised to the specified power.
Input
Integer N to raise
Integer P power
Output
Integer R
Constraints
0 < N < 10^19
0 < P < 10^6
Example
Input
7
2
Output
9

Game modes
Fastest, Shortest

Test cases
Square Test
Input
7 2
Output
9

Validator 1 Validator
Input
2 2
Output
4

Cubic Test
Input
3 3
Output
7

Validator 2 Validator
Input
4 3
Output
4

Pow Five Test
Input
16 5
Output
6

Validator 3 Validator
Input
24 5
Output
4

Big big Test
Input
123 15
Output
7

Validator 4 Validator
Input
765 15
Output
5

Madness Test
Input
9223372036854775807 515648
Output
1

Validator 5 Validator
Input
8543489851484547543 442447
Output
7

Solution language

Solution

Stub generator input