#include <stdio.h>

unsigned char mem[32], pc, ak;
FILE *in;
char s[16];

int main()
{
  in = stdin;

  while(1)
    {
      int i, j;
      for(i=0; i<32; i++)
	{
	  if (fscanf(in, " %s", s) <1) return 0;
	  mem[i] = s[0]-'0';
	  for(j=1; j<8; j++)
	    {
	      mem[i] = mem[i]*2+s[j]-'0';
	    }
	}
      pc = 0;
      ak = 0;
      while(1)
	{
	  switch (mem[pc]>>5)
	  {
	  case 0 : mem[mem[pc]&0x1f] = ak; break;
	  case 1 : ak = mem[mem[pc]&0x1f]; break;
	  case 2 : if (ak == 0) pc = (mem[pc]&0x1f)-1; break;
	  case 3 : break;
	  case 4 : ak--;break;
	  case 5 : ak++;break;
	  case 6 : pc = (mem[pc] & 0x1f) -1; break;
	  case 7 : goto weiter;
	  }
	  pc++;
	  pc = pc & 0x1f;
	}
      ;weiter:
      for(i=7; i>=0; i--)
	{
	  printf("%d", ((ak>>i)&1));
	}
      printf("\n");
    }

  return 0;
}
