require 'prime' L, H = gets.split.map(&:to_i) factor = 0 ans = 0 (Math.sqrt(H).round).downto(2){|i| (H / i).downto(i){|j| if i * j < L break end tmp = Prime.prime_division(i * j)[0][0] if factor < tmp factor = tmp ans = i * j end if factor > i p ans exit end } } p ans