sub f{$_[0]%$_||f("@_"/$_)for$_||2.."@_"**(1/$n)*!!--$n+.5;$%+=!$n++}print f<>=~$"+$',$n=$`