// Arup Guha
// 11/20/2013
// Solution to 2013 Pacific NorthWest Problem F: Federation

import java.util.*;

public class f {

	public static void main(String[] args) {

		// All known perfect numbers are of the form 2^(p-1)*(2^p - 1),
		// where 2^p - 1 is prime. Here are the ones less than 100,000.
		int[] perfect = {6, 28, 496, 8128};

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();

		while (n != -1) {

			// Try to match to our perfect number list.
			boolean flag = false;
			for (int i=0; i<perfect.length; i++) {
				if (n == perfect[i]) {
					flag = true;

					// Print in their annoying format.
					System.out.print(n+" = 1");
					for (int j=2; j<=n/2; j++)
						if (n%j == 0)
							System.out.print(" + "+j);
					System.out.println();
					break;
				}
			}

			// Fail case.
			if (!flag) System.out.println(n+" is NOT perfect.");

			// Go to the next case.
			n = stdin.nextInt();
		}
	}
}