function main(input) { let [w] = getIntegers(input); let [d] = getIntegers(input); while(d > 1) { w = w - Math.floor(w / (d*d)); d--; } console.log(w); } //-- functions ------------------------------------ function getIntegers(lines) { return lines.shift().split(" ").map(function(e) { return Number(e); }); } function getStrings(lines) { return lines.shift().split(" "); } function twoDimensionalArray(h, w, value) { const list = new Array(h); for(let i=0; i 0) str += " "; str += e; }); return str; }; main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));