#include using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector ans; auto f = [&] (string s, int a, int b, int c) -> string { auto g = [&] (int i) -> string { return i < 0 ? "A[" + to_string(-i) + "]" : string(1, i); }; return s + " " + g(a) + " " + g(b) + " " + g(c); }; int di = -1; bool fn2 = false; for (int i = 1; i <= N; i++) { char op; int val; cin >> op >> val; if (op == '+') { if (di == -1) { ans.push_back(f("add", 'a', 'a', -i)); } else if (!fn2) { ans.push_back(f("mul", 'b', -di, -i)); ans.push_back(f("add", 'a', 'a', 'b')); } else { ans.push_back(f("mul", 'b', 'd', -i)); ans.push_back(f("add", 'a', 'a', 'b')); } } else if (op == '*') { ans.push_back(f("mul", 'a', 'a', -i)); } else { if (di == -1) { di = i; } else { if (!fn2) { fn2 = true; ans.push_back(f("mul", 'd', -di, -i)); } else { ans.push_back(f("mul", 'd', 'd', -i)); } } } } ans.push_back(f("div", 'a', 'a', 'd')); cout << ans.size() << '\n'; for (auto s : ans) cout << s << '\n'; }