# Simple Computers

Time Limit: Java: 2000 ms / Others: 2000 ms

Memory Limit: Java: 65536 KB / Others: 65536 KB

## Description

 You are to write an interpreter for a simple computer. This computer usesa processor with a small number of machine instructions. Furthermore, itis equipped with 32 byte of memory, one 8-bit accumulator (accu) and a 5-bitprogram counter (pc). The memory contains data as well as code, which isthe usual von Neumann architecture. The program counter holds the address of the instruction to be executednext. Each instruction has a length of 1 byte - the highest 3 bits definethe type of instruction and the lowest 5 bits define an optional operandwhich is always a memory address (xxxxx). For instructionsthat don't need an operand the lowest 5 bits have no meaning(-----). Here is a list of the machine instructions and theirsemantics: 000xxxxx   STA x   store the value of the accu into memory byte x001xxxxx   LDA x   load the value of memory byte x into the accu010xxxxx   BEQ x   if the value of the accu is 0 load the value x into the pc011-----   NOP     no operation100-----   DEC     subtract 1 from the accu101-----   INC     add 1 to the accu110xxxxx   JMP x   load the value x into the pc111-----   HLT     terminate program In the beginning, program counter and accumulator are set to 0. Afterfetching an instruction but before its execution, the program counteris incremented. You can assume that programs will terminate.

## Input

The input file contains several test cases. Each test case specifies thecontents of the memory prior to execution of the program. Byte 0 through31 are given on separate lines in binary representation. A byte is denotedby its highest-to-lowest bits. Input is terminated by EOF.

## Output

For each test case, output on a line the value of the accumulator ontermination in binary representation, again highest bits first.

## Sample Input

00111110
10100000
01010000
11100000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00111111
10000000
00000010
11000010
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
11111111
10001001

## Sample Output

10000111

None

## Source

University of Ulm Local Contest 2000