Back
Close

DarkGCD

Statement

 Goal

The greatest common divisor (GCD) of two integers, which are not all zero, is the largest positive integer that divides each of the integers.


Compute the greatest common divisor of |N|to the power of|M| and |M|to the power of|N| where N and M are given integers.

Note: 0 power 0 equals 1
Input
Line 1 : An integer N
Line 2 : An integer M
Output
Line1 : The greatest common divisor of |M|^|N| and |N|^|M|
Constraints
-10≤ N ≤10
-10≤ M ≤ 10
Example
Input
2
6
Output
4

Game modes
Fastest, Shortest

Test cases
Simple Case Test
Input
2 6
Output
4

Simple Validator
Input
-5 5
Output
3125

Negative Test
Input
-2 -8
Output
64

Mix Validator
Input
-6 4
Output
16

Trap Test
Input
-10 5
Output
3125

Trivial Validator
Input
0 0
Output
1

Test 5 Test
Input
-3 -4
Output
1

Validator 5 Validator
Input
6 -9
Output
19683

Solution language

Solution

Stub generator input