#include <algorithm>
#include <cstdio>
#include <numeric>
using namespace std;
int a[100001], cnt;
int main()
{
    int n;
    while (scanf("%d", &n), ~n)
    {
        int cnt = 0;
        for (int i = 1; (i << 1) <= n; i++)
            if (n % i == 0)
                a[cnt++] = i;
        if (n != accumulate(a, a + cnt, 0))
            printf("%d is NOT perfect.", n);
        else
        {
            printf("%d", n);
            for (int i = 0; i < cnt; i++)
                printf(" %c %d", "=+"[i > 0], a[i]);
        }
        putchar('\n');
    }
    return 0;
}