require 'prime' n=gets.to_i c=Prime.prime_division(n) c.each{|e| if e[0]==2 if n==3||c.include?(3) p 3 else p 4 end else p e[0] end exit } p n