### Password

#### Problem Description

Everyone knows PY, who is an attractive boy. One day, he holds an interesting party. Almost everyone in the world wants to take part in his party. You have to solve the password in order to get the party invitation.

This password includes six digits, and you can do six operations on this password.

S_L: The cursor position is unchanged, exchange the number where the cursor is located with the one on its left.

S_R: The cursor position is unchanged, exchange the number where the cursor is located with the one on its right.

Left：Move the cursor left by one unit.

Right：Move the cursor right by one unit.

Up: The cursor position is unchanged, the number where the cursor is located adds one. The number should be less than or equal to 9.

Down: The cursor position is unchanged, the number where the cursor is located subtract one. The number should be greater than or equal to 0.

Attention: The first digit and sixth digits are not connected. So if cursor locate in the first digits, you cannot reach to the sixth digits from Left operation.

You will get an initial password and the initial position of the cursor is 1, which is the left most digit. With the six operations described above you will be able to obtain the target password. By the time the cursor is allowed to stop at any position.

If you can solve the password with minimal operator, you will be able to attend py's party.

#### Input

The first line of the input contains integer t (1 ≤ t ≤ 1000) ,the number of cases.

For each test case, there are only one line contains two integers a, b (100000<=a, b<=999999) a indicates the initial password and b indicates the target password.

#### Output

For each test case, you should print only one positive integer, which is the minimal number of operations.

#### Sample Input

3 123456 623451 100000 999999 100009 900001

#### Sample Output

15 58 14

#### Hint

For the first case, you should perform 5 Up operation, 5 Right operation and 5 Down operation.