Problem:
Score : 300 points

Problem Statement

Sitting in a station waiting room, Joisino is gazing at her train ticket.

The ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).

In the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.

The given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.

Constraints

0≤A,B,C,D≤9

All input values are integers.

It is guaranteed that there is a solution.

Input

Input is given from Standard Input in the following format:

ABCD

Output

Print the formula you made, including the part =7.

Use the signs + and -.

Do not print a space between a digit and a sign.

Sample Input 1

1222

Sample Output 1

1+2+2+2=7

This is the only valid solution.

Sample Input 2

0290

Sample Output 2

0-2+9+0=7

0 - 2 + 9 - 0 = 7 is also a valid solution.

Sample Input 3

3242

Sample Output 3

3+2+4-2=7

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using static System.Console;
using System.Text;
using System.Linq;
using static System.Math;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Program
{
    public static cp alg;
    public static int[] memo;
    public static int N;
    public static int M;
    public static int num;
    public static string s;
    public static int[] A;
    public static int[] temp;
    //public static int[][] AB;
    //public static int[] B;
    //public static int[] C;
    static void Main(string[] args)
    {
        alg = new cp();
        s = alg.inputString();
        string ans = "";
        var siki = new string[2] { "+","-"};
        for (int a = 0; a < 2; a++)
        {
            for (int b = 0; b < 2; b++)
            {
                for (int c = 0; c < 2; c++)
                {
                    string temp = string.Format("{0}{1}{2}{3}{4}{5}{6}",s[0],siki[a],s[1],siki[b],s[2],siki[c],s[3]);
                    //WriteLine(temp+"="+calc(temp).ToString());
                    if (calc(temp)==7)
                    {

                        ans =temp+"=7";

                    }
                }
            }
        }
        WriteLine(ans);


    }
    static int calc(string s)
    {
        
        int num = 0;
        
        string[] arr = s.Split('+');
        

        for (int a = 0; a < arr.Length; a++)
        {
            var arr2 = arr[a].Split('-').Select(x=>int.Parse(x)).ToArray();
            int num2 = 0;
            for (int b = 0; b < arr2.Length; b++)
            {
                if (b == 0)
                {
                    num2 += arr2[b];
                }
                else
                {
                    num2 -= arr2[b];
                }
            }
            num += num2;
        }
        
        return num;
    }
}

class cp
{

    public cp()
    {
    }
    public string subChar(string s,int index,char c)
    {
        char[] arr= s.ToCharArray();
        arr[index] = c;
        return new string(arr);
    }
    public int GCD(int a, int b)
    {
        return a % b == 0 ? b : GCD(b, a % b);
    }
    public int LCM(int a, int b)
    {
        return a * b / GCD(a, b);
    }
    public int countString(string s, string key)
    {
        return (s.Length - s.Replace(key, "").Length)/key.Length;
    }
    public string Yn(bool f)
    {
        if (f)
        {
            return "Yes";
        }
        else
        {
            return "No";
        }
    }
    public string YN(bool f)
    {
        if (f)
        {
            return "YES";
        }
        else
        {
            return "NO";
        }
    }
    public string yn(bool f)
    {
        if (f)
        {
            return "yes";
        }
        else
        {
            return "no";
        }
    }
    public void inputSkip()
    {
        ReadLine();
        return;
    }
    public string inputString()
    {
        return ReadLine();
    }
    public string[] inputSplitString()
    {
        return ReadLine().Split();
    }
    public string[] inputLinesString(int len)
    {
        var arr = new string[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine();
        }
        return arr;
    }
    public string[][] inputJaggedArrayString(int len)
    {
        var arr = new string[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split();
        }
        return arr;
    }
    public int inputInt()
    {
        return int.Parse(ReadLine());
    }
    public int[] inputSplitInt()
    {
        return ReadLine().Split().Select(i => int.Parse(i)).ToArray();
    }
    public int[] inputLinesInt(int len)
    {
        var arr = new int[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = int.Parse(ReadLine());
        }
        return arr;
    }
    public int[][] inputJaggedArrayInt(int len)
    {
        var arr = new int[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split().Select(i => int.Parse(i)).ToArray();
        }
        return arr;
    }
    public long inputLong()
    {
        return long.Parse(ReadLine());
    }
    public long[] inputSplitLong()
    {
        return ReadLine().Split().Select(i => long.Parse(i)).ToArray();
    }
    public long[] inputLinesLong(long len)
    {
        var arr = new long[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = long.Parse(ReadLine());
        }
        return arr;
    }
    public long[][] inputJaggedArrayLong(int len)
    {
        var arr = new long[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split().Select(i => long.Parse(i)).ToArray();
        }
        return arr;
    }
    public double inputDouble()
    {
        return double.Parse(ReadLine());
    }
    public double[] inputSplitDouble()
    {
        return ReadLine().Split().Select(i => double.Parse(i)).ToArray();
    }
    public double[] inputLinesDouble(int len)
    {
        var arr = new double[len];
        for (int a = 0; a < len; a++)
        {
            arr[a] = double.Parse(ReadLine());
        }
        return arr;
    }
    public double[][] inputJaggedArrayDouble(int len)
    {
        var arr = new double[len][];
        for (int a = 0; a < len; a++)
        {
            arr[a] = ReadLine().Split().Select(i => double.Parse(i)).ToArray();
        }
        return arr;
    }
}