xs=`factor #{gets.to_i}`.split[1..-1].map &:to_i a=(xs[0]==2&&xs[1]==2)?4:xs[-1] for x in xs if x > 2 a = [a,x].min end end p a