//* Problem  : C - Simple Computers
//* Contest  : acm.tju.edu.cn
//* Origin   : University of Ulm Local Contest 2000
//* Type     : Solution
//* Date     : 2008.06.06
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 8.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <iostream>
using namespace std;
#define int64 long long
#define INF 1000000000
#define EPS 1E-8

#define ALL(a) a.begin(), a.end()
#define PB(a, v) a.push_back(v)
#define MP(a,b) make_pair(a, b)
#define FOR(i, n) for (int i = 0; i < (int)(n); i++)
#define FORO(i, obj) for (int i = 0; i < (int)(obj.size); i++)


int main()
{
#ifdef _DEBUG
	freopen("1166.in", "r", stdin);
#endif
	char s[100]; int i = 0;
	while (scanf("%s", s) == 1)
	{
		int mem[32], pc = 0, cmd, acc = 0, f = 0;
		for (int i = 0; i < 32; i++)
		{
			int v = 0; for (int i = 0; i < 8; i++) v |= (s[i]=='1')?(1<<(7-i)):0; mem[i] = v;
			if (i != 31) scanf("%s", s);
		}
		while (1)
		{
			switch ((cmd = (mem[pc++%32]))>>5)
			{
			case 0: mem[cmd%32] = acc; break;
			case 1: acc = mem[cmd%32]; break;
			case 2: if (!acc) pc = cmd%32; break;
			case 4: acc = (acc - 1 + (1<<8))%(1<<8); break;
			case 5: acc = (acc + 1 + (1<<8))%(1<<8); break;
			case 6: pc = cmd%32; break;
			case 7: f = 1; break;
			}
			if (f) break;
		}
		for (int i = 7; i >= 0; i--) putchar(!!(acc&(1<<i)) + '0'); putchar('\n');

	}
	return 0;
}
