638A.md (2320B)
1 Source: https://codeforces.com/problemset/problem/638/A 2 3 A. Home Numbers 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 The main street of Berland is a straight line with *n* houses built along it (*n* is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbered from 1 to *n* - 1 in the order from the beginning of the street to the end (in the picture: from left to right). The houses with even numbers are at the other side of the street and are numbered from 2 to *n* in the order from the end of the street to its beginning (in the picture: from right to left). The corresponding houses with even and odd numbers are strictly opposite each other, that is, house 1 is opposite house *n*, house 3 is opposite house *n* - 2, house 5 is opposite house *n* - 4 and so on. 22 23  24 25 Vasya needs to get to house number *a* as quickly as possible. He starts driving from the beginning of the street and drives his car to house *a*. To get from the beginning of the street to houses number 1 and *n*, he spends exactly 1 second. He also spends exactly one second to drive the distance between two neighbouring houses. Vasya can park at any side of the road, so the distance between the beginning of the street at the houses that stand opposite one another should be considered the same. 26 27 Your task is: find the minimum time Vasya needs to reach house *a*. 28 29 Input 30 31 The first line of the input contains two integers, *n* and *a* (1 ≤ *a* ≤ *n* ≤ 100 000) — the number of houses on the street and the number of the house that Vasya needs to reach, correspondingly. It is guaranteed that number *n* is even. 32 33 Output 34 35 Print a single integer — the minimum time Vasya needs to get from the beginning of the street to house *a*. 36 37 Examples 38 39 Input 40 41 ``` 42 4 2 43 ``` 44 45 Output 46 47 ``` 48 2 49 ``` 50 51 Input 52 53 ``` 54 8 5 55 ``` 56 57 Output 58 59 ``` 60 3 61 ``` 62 63 Note 64 65 In the first sample there are only four houses on the street, two houses at each side. House 2 will be the last at Vasya's right. 66 67 The second sample corresponds to picture with *n* = 8. House 5 is the one before last at Vasya's left.