#include <cassert>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;

struct instr {
    char op; int a, b, c;
};

class Program : public vector<instr> {
    void emit(char op, int a, int b, int c) { push_back({op, a, b, c}); }
    int idx = 3;
    vector<int> free_indices;
public:
    int new_idx() {
        if (free_indices.empty()) return idx++;
        else {
            int ret = free_indices.back();
            free_indices.pop_back();
            return ret;
        }
    }
    void free_idx(int i) { free_indices.push_back(i); }
    void emit_lt(int a, int b, int c) { emit('<', a, b, c); }
    void emit_add(int a, int b, int c) { emit('+', a, b, c); }

    vector<long long> execute(long long a, long long b) {
        vector<long long> state(200000, 0);
        state[0] = a; state[1] = b;
        int mx = 2;
        for (auto &[op, i, j, k] : *this) {
            if (op == '<') state[k] = (long long)(state[i] < state[j]);
            else state[k] = state[i] + state[j];
            mx = max({mx, i, j, k});
            // cerr << op << " " << i << " " << j << " " << k << endl;
            // for (int i = 0; i <= mx; i++)
            //     cerr << i << " " << state[i] << endl;
        }
        state.resize(mx);
        return state;
    }
};

int main() {
    Program prog;
    const int A = 0, B = 1, ANS = 2,
        const0 = prog.new_idx(), const1 = prog.new_idx();
    prog.emit_add(A, B, const1);
    prog.emit_lt(const0, const1, const1);

    function<void(int, int)> emit_neg = [&](int i, int j) {
        prog.emit_lt(i, const1, j);
    };
    function<void(int, int, int)> emit_or = [&](int i, int j, int k) {
        prog.emit_add(i, j, k);
        prog.emit_lt(const0, k, k);
    };
    function<void(int, int, int)> emit_not_and = [&](int i, int j, int k) {
        const int notj = prog.new_idx();
        emit_neg(j, notj);
        emit_or(i, notj, k);
        emit_neg(k, k);
        prog.free_idx(notj);
    };
    function<void(int, int, int)> emit_and = [&](int i, int j, int k) {
        const int noti = prog.new_idx(), notj = prog.new_idx();
        emit_neg(i, noti);
        emit_neg(j, notj);
        emit_or(noti, notj, k);
        emit_neg(k, k);
        prog.free_idx(noti);
        prog.free_idx(notj);
    };
    function<void(int, int)> emit_ash = [&](int i, int s) {
        while (s--) prog.emit_add(i, i, i);
    };

    const int a1 = prog.new_idx(), b1 = prog.new_idx();
    int pow2[30];
    for (int i = 0; i < 30; i++) pow2[i] = prog.new_idx();
    prog.emit_add(const0, const1, pow2[0]);
    for (int i = 1; i < 30; i++)
        prog.emit_add(pow2[i-1], pow2[i-1], pow2[i]);
    int a_bin[30], b_bin[30];
    for (int i = 29; i >= 0; i--) {
        const int tmp = prog.new_idx(), ai = prog.new_idx(), bi = prog.new_idx();
        prog.emit_add(a1, pow2[i], tmp);
        prog.emit_lt(A, tmp, ai);
        emit_neg(ai, ai);
        prog.emit_add(b1, pow2[i], tmp);
        prog.emit_lt(B, tmp, bi);
        emit_neg(bi, bi);
        prog.emit_add(const0, ai, tmp);
        emit_ash(tmp, i);
        prog.emit_add(a1, tmp, a1);
        prog.emit_add(const0, bi, tmp);
        emit_ash(tmp, i);
        prog.emit_add(b1, tmp, b1);
        a_bin[i] = ai; b_bin[i] = bi;
        prog.free_idx(tmp);
    }
    for (int i = 0; i < 30; i++) {
        for (int j = 0; j < 30; j++) {
            const int tmp = prog.new_idx();
            emit_and(a_bin[i], b_bin[j], tmp);
            for (int k = 0; k < i + j; k++) prog.emit_add(tmp, tmp, tmp);
            prog.emit_add(ANS, tmp, ANS);
            prog.free_idx(tmp);
        }
    }
    cout << prog.size() << endl;
    for (auto &[op, i, j, k] : prog)
        cout << op << ' ' << i << ' ' << j << ' ' << k << endl;
}


Measured memory_bytes: 3516