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