141B.md (2013B)
1 Source: https://codeforces.com/problemset/problem/141/B 2 3 B. Hopscotch 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 So nearly half of the winter is over and Maria is dreaming about summer. She's fed up with skates and sleds, she was dreaming about Hopscotch all night long. It's a very popular children's game. The game field, the court, looks as is shown in the figure (all blocks are square and are numbered from bottom to top, blocks in the same row are numbered from left to right). Let us describe the hopscotch with numbers that denote the number of squares in the row, staring from the lowest one: 1-1-2-1-2-1-2-(1-2)..., where then the period is repeated (1-2). 22 23  24 25 The coordinate system is defined as shown in the figure. Side of all the squares are equal and have length *a*. 26 27 Maria is a very smart and clever girl, and she is concerned with quite serious issues: if she throws a stone into a point with coordinates (*x*, *y*), then will she hit some square? If the answer is positive, you are also required to determine the number of the square. 28 29 It is believed that the stone has fallen into the square if it is located strictly inside it. In other words a stone that has fallen on the square border is not considered a to hit a square. 30 31 Input 32 33 The only input line contains three integers: *a*, *x*, *y*, where *a* (1 ≤ *a* ≤ 100) is the side of the square, *x* and *y* ( - 106 ≤ *x* ≤ 106, 0 ≤ *y* ≤ 106) are coordinates of the stone. 34 35 Output 36 37 Print the number of the square, inside which the stone fell. If the stone is on a border of some stone or outside the court, print "-1" without the quotes. 38 39 Examples 40 41 Input 42 43 ``` 44 1 0 0 45 ``` 46 47 Output 48 49 ``` 50 -1 51 ``` 52 53 Input 54 55 ``` 56 3 1 1 57 ``` 58 59 Output 60 61 ``` 62 1 63 ``` 64 65 Input 66 67 ``` 68 3 0 10 69 ``` 70 71 Output 72 73 ``` 74 5 75 ``` 76 77 Input 78 79 ``` 80 3 0 7 81 ``` 82 83 Output 84 85 ``` 86 -1 87 ``` 88 89 Input 90 91 ``` 92 3 4 0 93 ``` 94 95 Output 96 97 ``` 98 -1 99 ```