let lcm = function(...x) {
let j = Math.max.apply(null, x);
while(true){
if(x.every((b)=>j%b==0)) {
return j; break;
}
else j++;
}
}
let gcd = function(...x) {
let j = Math.min.apply(null, x);
while(j >= 1){
if(x.every((b)=>b%j==0)) {
return j; break;
}
else j--;
}
}