#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <cmath>
#include <stdint.h>
#include <stack>
#include <set>
 
using namespace std;
 
inline int32_t GetC(wchar_t c) {
	if (c == L'·') return 0;
	if (c == L'-') return 1;
	if (c == L'=') return 2;
	if (c == L'±') return 3;
	if (c == L'#') return 4;
	if (c == L'¥') return 5;
 
	cout << "ERROR! GetC failed" << endl;
	return 0;
}
 
int32_t ToBase10(wstring code) {
	int32_t n = 0;
	int32_t mul = 1;
 
	for (int32_t i = code.length() - 1; i >= 0; --i) {
		n += GetC(code[i]) * mul;
		mul *= 6;
	}
 
	return n;
}
 
int32_t regs[6];
stack<int32_t> st;
stack<int32_t> rst;
set<uint32_t> jlocks;
 
int main() {
	//wstring code(L"±·····=¥¥¥¥¥#-#±=-±¥¥¥-±·-#-±·¥±-±=¥=-±±-=-±±-·-±=#--±-¥±-±·¥=-±±·±-±±··-±±··-±=#¥-±=··-±¥¥#-=--=·=±-·¥¥··=····=±¥");
	wstring code(L"#-··-·±¥¥=-±-·-=-¥··-·-#±==±-=±-==-=-±····±¥--±··--=·-·±¥¥-·¥-=--·=·±¥··-==-·=-±±±·-=±-±·¥=-=#¥·#±····±¥--±·-#-=#¥·#-·¥¥¥¥¥¥-=¥=-¥¥¥¥-=±=±¥--¥--#-±··--=#==·#···#¥=-±-¥±=····¥·--±=-·-=#¥·#-±·¥=-=#¥·#-·±¥¥·=#-=##--#--#-±··--=#==·#··--·--=·±···-#-¥=···--=·-=·±···-¥=·-±=##-=#¥·#-···-·±·-±----=·-=-#±=-#--·±···-¥=·-±--#-=#¥·#-±·-¥-···±±±±-=·-=-#±±-#--·±···-#-¥-=#-=¥=-¥=¥·¥-#--¥----±··±-=-±···=·=--=--=¥=-¥#-#-¥±--¥----±··=-=-±···=·=--=--=¥=-¥¥#-#±=--¥--#--±--=-±··--±··--==-=±-±·-#-=##=#=-±··--=##·#±==±-··=-·¥#-±±--=#±·=-±·-#-=###=#-±-=·-==#·=#¥·#-==--=##·=--=-=·-±··--=##·#±-=#-±·-#-==#±#=#-##==#=··==---==-=±-=#-=¥=-¥");
	//wstring code(L"-±¥¥¥-±·-#-±·¥±-±=¥±-±±·=-±=#¥-±±·--±·¥=-±±·=-±=¥±-±=#¥-±=¥¥-±=¥±-±=---±¥¥#-=--=·==-····=¥·¥··=····=-·¥¥¥");
	uint32_t pos = 0;
	do {
		wstring op = code.substr(pos, 2);
		if (op == L"-·") { // pushi
			st.push(ToBase10(code.substr(pos + 2, 6)));
			pos += 8;
		}
		else if (op == L"--") { // pushr
			st.push(regs[ToBase10(code.substr(pos + 2, 1))]);
			pos += 3;
		}
		else if (op == L"-=") { // popr
			regs[ToBase10(code.substr(pos + 2, 1))] = st.top();
			st.pop();
			pos += 3;
		}
		else if (op == L"-±") { // pushi
			st.push(ToBase10(code.substr(pos + 2, 3)));
			pos += 5;
		}
		else if (op == L"=·") { // jumpi
			pos = ToBase10(code.substr(pos + 2, 6));
		}
		else if (op == L"=-") { // jumpr
			pos = regs[ToBase10(code.substr(pos + 2, 1))];
		}
		else if (op == L"==") { // jumplei
			if (regs[ToBase10(code.substr(pos + 2, 1))] < regs[ToBase10(code.substr(pos + 3, 1))]) {
				pos = ToBase10(code.substr(pos + 4, 6));
			}
			else {
				pos += 10;
			}
		}
		else if (op == L"=±") { // jumpler
			if (regs[ToBase10(code.substr(pos + 2, 1))] < regs[ToBase10(code.substr(pos + 3, 1))]) {
				pos = regs[ToBase10(code.substr(pos + 4, 1))];
			}
			else {
				pos += 5;
			}
		}
		else if (op == L"±·") { // call
			regs[5] = pos + 8;
			pos = ToBase10(code.substr(pos + 2, 6));
		}
		else if (op == L"#·") { // add
			regs[ToBase10(code.substr(pos + 3, 1))] = (regs[ToBase10(code.substr(pos + 2, 1))] + regs[ToBase10(code.substr(pos + 3, 1))]) % ToBase10(L"¥¥¥¥¥¥");
			pos += 4;
		}
		else if (op == L"#-") { // dec
			regs[ToBase10(code.substr(pos + 3, 1))] = (regs[ToBase10(code.substr(pos + 2, 1))] - regs[ToBase10(code.substr(pos + 3, 1))]) % ToBase10(L"¥¥¥¥¥¥");
			pos += 4;
		}
		else if (op == L"#=") { // mul
			regs[ToBase10(code.substr(pos + 3, 1))] = (regs[ToBase10(code.substr(pos + 2, 1))] * regs[ToBase10(code.substr(pos + 3, 1))]) % ToBase10(L"¥¥¥¥¥¥");
			pos += 4;
		}
		else if (op == L"#±") { // div
			regs[ToBase10(code.substr(pos + 3, 1))] = (regs[ToBase10(code.substr(pos + 2, 1))] / regs[ToBase10(code.substr(pos + 3, 1))]);
			pos += 4;
		}
		else if (op == L"##") { // mod
			regs[ToBase10(code.substr(pos + 3, 1))] = (regs[ToBase10(code.substr(pos + 2, 1))] % regs[ToBase10(code.substr(pos + 3, 1))]);
			pos += 4;
		}
		else if (op == L"¥·") { // outascii
			cout << (char)regs[ToBase10(code.substr(pos + 2, 1))];
			pos += 3;
		}
		else if (op == L"¥¥") { // stop
			if (code[pos + 2] == L'¥') {
				return 0;
			}
		}
		else {
			cout << "Something went terribly wrong" << endl;
			wcout << "op: " << op << endl;
			pos += 1;
		}
	} while (1);
	return 0;
}