Vasya frequently travels by intercity bus. The tickets for these buses are rectangular, presented as a grid of numbers ( rows of digits each), with the word Ticket on both sides. Each side of a cell containing a digit measures cm.

The first row represents the thousands digit of the ticket price, the second row the hundreds digit, the third row the tens digit, and the fourth row the units digit.
The driver takes scissors and cuts this grid into parts (left and right, relative to the cutting line). The thousands digit of the ticket price is the rightmost digit remaining to the left of the cutting line in the first row. Similarly, the hundreds digit is the rightmost digit remaining to the left of the cutting line in the second row, the tens digit in the third row, and the units digit in the fourth row. If the ticket price is , the driver will cut the ticket as shown below (the cutting line is indicated in bold):

It is guaranteed that the driver will not cut along the top or bottom edges of the ticket.
Vasya wants to know how long it will take the driver to cut the ticket. Through experimentation, he discovered that the driver cuts one centimeter of the ticket per second. Find out how many seconds it will take the driver to issue the ticket.
All numbers in this problem are integers.
The input consists of a single number — the price of Vasya's ticket (1 \leq N \leq 9999).
Output the number of seconds it will take the driver to issue Vasya's ticket.
Example 1