import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
 * TODO Put here a description of what this class does.
 * 
 * @author songm. Created Oct 16, 2013.
 */
public class Main {

    /**
     * TODO Put here a description of what this method does.
     * 
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub.
        // Scanner scanner = new Scanner(System.in);
        // String num = scanner.nextLine();
        // int total = Integer.parseInt(num);
        ArrayList<Integer> array = new ArrayList<Integer>();
        ArrayList<Integer> sum = new ArrayList<Integer>();
        ArrayList<String> what = new ArrayList<String>();

        array.add(40);
        array.add(47);
        array.add(74);
        array.add(77);
        array.add(70);
        array.add(400);
        

        Collections.sort(array);
        System.out.println(array);
        int sum2 = 0;
        int sum3 = 0;
        for(int m = 0; m< array.size(); m++) {
            for (int i = 0; i < 8; i++) {

                for (int j = i + 1; j < 8; j++) {
                    what.add(sum2+"+"+sum3+"="+(sum2+sum3));
                    sum.add(sum2 + sum3);
                    sum2 += 7;
                }
                sum3 += 4;
                sum2 = 0;
            }
            sum3 = array.get(m);
        }

        Collections.sort(sum);
        Collections.sort(what);
        System.out.println(sum);
        System.out.println(what);
        // for (int i = 0; i < total; i++) {
        // String next = scanner.nextLine();
        // int nextInt = Integer.parseInt(num);
        // array.add((long) 0);
        // for (int j = 0; j < 17; j++) {
        // array.add((long) (4 * Math.pow(10, j)));
        // array.add((long) (7 * Math.pow(10, j)));
        // }
        //
        //
        //
        // for(int m = 0; m< array.size(); m++){
        // for(int n = 0; n<array.size(); )
        // }
        // }

    }

}
