In this problem you will write a simple generator of Brainfuck ([https://en.wikipedia.org/wiki/Brainfuck](https://en.wikipedia.org/wiki/Brainfuck)) calculators.

You are given an arithmetic expression consisting of integers from 0 to 255 and addition/subtraction signs between them. Output a Brainfuck program which, when executed, will print the result of evaluating this expression.

We use a fairly standard Brainfuck interpreter for checking the programs:
-  30000 memory cells.-  memory cells store integers from 0 to 255 with unsigned 8-bit wraparound.-  console input (, command) is not supported, but it's not needed for this problem.
The only line of input data contains the arithmetic expression. The expression will contain between 2 and 10 operands, separated with arithmetic signs plus and/or minus. Each operand will be an integer between 0 and 255, inclusive. The calculations result is guaranteed to be an integer between 0 and 255, inclusive (results of intermediary calculations might be outside of these boundaries).
You can download the source code of the Brainfuck interpreter by the link [http://assets.codeforces.com/rounds/784/bf.cpp](//assets.codeforces.com/rounds/784/bf.cpp). We use this code to interpret outputs.
2+3
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
9-7
++++++++++++++++++++++++++++++++++++++++++++++++++.>
1+1+1
+++++++++++++++++++++++++++++++++++++++++++++++++++.>
1+11+111
+++++++++++++++++++++++++++++++++++++++++++++++++.>
++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++.>
111-11-1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
1+1-1+1-1+1-1+1-1+1
++++++++++++++++++++++++++++++++++++++++++++++++++.>
9+1
+++++++++++++++++++++++++++++++++++++++++++++++++.>
++++++++++++++++++++++++++++++++++++++++++++++++.>
10-1
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
31+49+49+71-51-61+59-111+51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
255+255+255+255+255-255-255-255-255-255
++++++++++++++++++++++++++++++++++++++++++++++++.>
100+100+10+10+10+10+10+5
++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
255-255+255-255+255-255+255-255+255
++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
0-255-255-255-255+255+255+255+255+255
++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
34+45+29-49+52-111-4+4+2+9
+++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++.>
0+0+0+0+0+0+0+0+0+0
++++++++++++++++++++++++++++++++++++++++++++++++.>
193+235+47+150+222-3-90-248-187-100
++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
66-165-34+209+76
+++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++++.>
++++++++++++++++++++++++++++++++++++++++++++++++++.>
36+90+6+102
++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++++.>
++++++++++++++++++++++++++++++++++++++++++++++++++++.>
255-12-34-56-69-78
++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
243-173+90-56+78-53+53-21
+++++++++++++++++++++++++++++++++++++++++++++++++.>
++++++++++++++++++++++++++++++++++++++++++++++++++++++.>
+++++++++++++++++++++++++++++++++++++++++++++++++.>
#include "testlib.h"
#include <bits/stdc++.h>

#define forn(i, n) for (int i = 0; i < int(n); i++)

using namespace std;

void fail(const string& message) {
    cerr << "ERROR: " << message << endl;
    exit(1);
}

string interpretCode(const string& commands)
{
    vector<unsigned char> data(1, 0);
    vector<unsigned char>::iterator dataPtr = data.begin();

    string::const_iterator instructionPtr = commands.begin();
    stack<string::const_iterator> instructionStack;

    int iterationCount = 0;
    string result;

    while (instructionPtr != commands.end())
    {
        iterationCount++;
        if (iterationCount > 50000000)
            fail("Too many instructions");

        switch (*instructionPtr)
        {
        case '<':
        {
            if (dataPtr != data.begin())
                dataPtr--;
            break;
        }
        case '>':
        {
            dataPtr++;
            if (dataPtr == data.end()) {
                if (data.size() < 30000)
                    data.push_back(0);
                dataPtr = data.end()-1;
            }
            break;
        }
        case '+':
        {
            (*dataPtr)++;
            break;
        }
        case '-':
        {
            (*dataPtr)--;
            break;
        }
        case '.':
        {
            result += (unsigned char)(*dataPtr);
            break;
        }
        case '[':
        {
            instructionStack.push(instructionPtr);

            if (*dataPtr == 0)
            {
                string::const_iterator startInstructionPtr = instructionPtr;
                while (++instructionPtr != commands.end())
                {
                    iterationCount++;
                    if (iterationCount > 50000000)
                        fail("Too many instructions");

                    if (*instructionPtr == '[')
                        instructionStack.push(instructionPtr);
                    else if (*instructionPtr == ']')
                    {
                        if (instructionStack.empty())
                            fail("Found a ']' that did not have a matching '['!");

                        string::const_iterator tempInstructionPtr = instructionStack.top();
                        instructionStack.pop();

                        if (startInstructionPtr == tempInstructionPtr)
                            break;
                    }
                }
            }
            break;
        }
        case ']':
        {
            if (instructionStack.empty())
                fail("Found a ']' that did not have a matching '['!");

            if (*dataPtr != 0)
                instructionPtr = instructionStack.top();
            else
                instructionStack.pop();

            break;
        }
        default:
            break;
        }

        if (instructionPtr == commands.end())
            fail("Invalid program");

        instructionPtr++;
    }

    if (!instructionStack.empty())
        fail("Found a '[' that did not have a matching ']'!");

    return result;
}

string readFile(const string& fileName) {
    ifstream in(fileName.c_str());
    string s, nxt;
    while (in >> nxt) {
        s += nxt;
        if (s.length() > 5000000) {
            fail("Too long program");
        }
    }

    return interpretCode(s);
}

int main(int argc, char* argv[]) {
    if (argc != 2) {
        fail("Usage: bf <fileName>");
    }

    cout << readFile(argv[1]);
}
