(* Problem   Simple Computer
 * Algorithm Simulation
 * Runtime   O(n)
 * Author    Walter Guttmann
 * Date      26.04.2000
 *)

program computer;

var f: text;
    s: string;
    hlt: boolean;
    i, j, pc, accu, instr: integer;
    mem: array [0..31] of integer;

begin
  while not eof(f) do begin
    for i := 0 to 31 do begin
      readln (s);
      mem[i] := 0;
      for j := 1 to 8 do
        mem[i] := mem[i] * 2 + (ord(s[j]) - ord('0'));
    end;
    pc := 0;
    accu := 0;
    hlt := false;
    while not hlt do begin
      instr := mem[pc];
      pc := (pc + 1) mod 32;
      case (asr (instr, 5)) of
        0: mem[instr & 31] := accu;
        1: accu := mem[instr & 31];
        2: if accu = 0 then pc := instr & 31;
        3: ;
        4: accu := (accu + 255) mod 256;
        5: accu := (accu + 1) mod 256;
        6: pc := instr & 31;
        7: hlt := true;
      end;
    end;
    for j := 1 to 8 do
      write ((asr (accu, 8-j) & 1):0);
    writeln;
  end;
end.

