#include <iostream> #include <cmath> #include <string> using namespace std; int give_value(); int give_address(); int give_dos(); struct node { int address; int dos; int value; }; int pc; int accu; string s="00000000"; node _node[32]; void give_to_bin(int num); int main() { //freopen("acm.acm","r",stdin); int i; int j; while(cin>>s) { _node[0].value = give_value(); _node[0].dos = _node[0].value>>5; _node[0].address = _node[0].value%32; for(i = 1; i <= 31; ++ i) { cin>>s; _node[i].value = give_value(); _node[i].dos = _node[i].value>>5; _node[i].address = _node[i].value%32; } pc = 0; accu = 0; while(true) { if(_node[pc].dos == 0) { _node[_node[pc].address].value = accu; _node[_node[pc].address].dos =_node[_node[pc].address].value>>5; _node[_node[pc].address].address = _node[_node[pc].address].value%32; ++ pc; } else if(_node[pc].dos == 1) { accu = _node[_node[pc].address].value; ++ pc; } else if(_node[pc].dos == 2) { if(accu == 0) { pc =_node[pc].address; } else { ++ pc; } } else if(_node[pc].dos == 3) { ++ pc; } else if(_node[pc].dos == 4) { if(accu == 0) { accu = 255; } else -- accu; ++ pc; } else if(_node[pc].dos == 5) { ++ accu; ++ pc; } else if(_node[pc].dos == 6) { pc = _node[pc].address; } else if(_node[pc].dos == 7) { break; } accu %= 256; pc %= 32; } give_to_bin(accu); cout<<s<<endl; } } int give_value() { int value = 0; int i; for(i = 7; i >= 0; -- i) { value += (s[i]-'0')*pow((double)2,7-i); } return value; } void give_to_bin(int num) { s = "00000000"; int i = 7; while(num) { s[i] = char(num%2+'0'); num /= 2; -- i; } }