import math
L, R = map(int, input().split())
G = L
for i in range(L+1, R+1):
    G = math.gcd(G, i)
print(G**L)