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