Steve "Woz" Wozniak — co-founder of Apple Computers — collected telephone numbers, amongst other things. His big dream was to get hold of a telephone number in which only one digit was repeated. However, for the largest part of his life, Silicon Valley did not have any zone codes of three equal digits. Therefore, Woz had to be satisfied with numbers like 221-111-1111.

When he was eavesdropping on the mobile telephone traffic, he noticed that a new zone code had been taken into use: 888. After months of administrative fuss and waiting he finally got hold of his number: 888-888-8888. It was his new mobile phone number and with that his most valuable collector's item. 

The number soon appeared to be useless. He received more than a hundred mistaken calls a day. At first, this amount of wrong connections seemed pretty inexplicable, given the fact that it was almost impossible to dial the number incorrectly. What was even more unusual was that no one could ever be heard on the other side of the connection. Just silence. Well, actually is was silence under various forms: death silence, sometimes the sound of a television in the background, or someone that was talking very quietly in English or in Spanish, or sometimes weird gargling sounds. Woz often kept listening, intrigued.

But one day, while he had his phone pressed to his ear, Woz clearly heard a woman's voice at a certain distance saying "Hey! What are you doing with that?". The receiver on the other side was torn away and the connection was broken. This was the solving piece of the puzzle. The hundreds of calls, the dead silence, the gargling sounds: babies. They had picked up the receiver and started pushing buttons on the bottom of the machine. And that made the same sound over and over: 'Beep beep beep beep beep beep beep beep beep beep." The American children had played their first prank, subconsciously. And the person who answered their calls was Woz.

This story contains a sense of justice being served, as Woz started his career as a prank caller and hacker of telephone systems. 

Assignment

To determine the chance that a baby coincidentally presses a certain telephone number, we have developed a score system for telephone numbers. The higher the score, the smaller the chance that that particular number will be called by accident. To calculate the score, we use the keyboard below. Here we have the rows and columns of the grid that is formed by the digits. The key 8, for example, is on row 2 and in column 1.

vingerbeweging
Keyboard of a mobile phone, of which we have numbered the rows and columns. 

Asked:

Example

>>> position(8)
(2, 1)
>>> position(0)
(3, 1)

>>> movement(8, 8)
0
>>> movement(8, 9)
1
>>> movement(8, 1)
3

>>> fingermovement('888-888-8888')
0
>>> fingermovement('053/67.83.47')
16