SP183 ASCIRC - Assembler circuits

Description

Bytetel Company decided to improve computers they produce. They want to replace assembler programs with special systems called assembler circuits. Assembler programs consist solely of assignments. Each assignment is determined by four elements: - two registers from which data are taken, - elementary operation that should be performed on the data, - register to which the result should be written.

Input Format

The number of test cases _t_ is in the first line of input, then _t_ test cases follow separated by an empty line. In the first line of each test case there is one integer _n_ (1

Output Format

For each test case you should output one line with the minimal number of gates in an assembler circuit equivalent to the given program.