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;x>2&&a=[a,x].min;end p a