while(True) :
    n = int(input())
    if n==-1 : break

    sum = 0
    res = []
    for i in range(1,int(n/2) + 1) :
        if n%i==0 :
            res.append(str(i))
            sum += i
    
    if sum==n :
        print(n,'='," + ".join(res))
    else :
        print(n,"is NOT perfect.")