#! ruby # yukicoder My Practice # author: Leonardone @ NEETSDKASU x = gets.to_i loop { d, m = x.divmod 4; if m != 0 then break else x = d end }; 3.step(x ** 0.5, 2) do |k| kk = k * k break if x < kk loop { d, m = x.divmod kk; if m != 0 then break else x = d end }; end puts x