In the new cell phone model, the developers provided only 5 buttons: "up arrow", "down arrow", "right arrow", "left arrow"; and «Ok». To dial a phone number, a virtual keyboard is displayed on the screen in the form of the following table:
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
exit |
0 |
call |
The cell phone user can move the cursor up, down, right or left in the cells of this table. To select a number, press the "Ok" button. After dialing all the digits, the user must move the cursor to the "call" cell; and click "Ok". The table is not "looped" (this means that pressing the right button, for example, from the cell with the number 6 will not move the cursor).
When you call up the on-screen keyboard, the cursor is on the button labeled "exit".
Given a seven-digit phone number, determine how many button presses the user must make to call that number.
Input
The input file contains a phone number containing exactly 7 digits.
Imprint
In the output file print a single number — the minimum number of clicks on all buttons in total, which is necessary to make a call to this number.
Examples
# |
Input |
Output |
1 |
0800000 |
12 |
2 |
1234567 |
24 |