import sys input = lambda :sys.stdin.readline()[:-1] from math import sqrt, pi, exp, log, log10, sin, cos, tan, ceil, floor, perm, comb, gcd, modf, prod, inf, nan def main(): L, R = map(int, input().split()) ans = 0 for i in range(R-L): ans = gcd((R+i) ** (R+i), (R+i+1) ** (R+i+1)) print(ans) if __name__ == '__main__': main()