const n = require("fs").readFileSync(0, "utf8").toString().trim().split('\n').map(Number);
for(let s of n) {
    if(s==-1) break;
    let str = [];
    let sum = 0;

    for(let i=1; i<=s/2; i++) {
        if(s%i==0) {
            sum += i;
            str.push(i);
        }
    }

    if(sum===s) {
        str = s.toString() + " = " + str.join(" + ");
    }
    else {
        str = s.toString() + " is NOT perfect."
    }
    console.log(str);
}