Ulica
Mirko and Slavko live in the same street. Houses with odd numbers are on the left side of the street, and those with even numbers are on the right side. The street is very long, as the picture shows its beginning:
Image: Hous
Mirko spread newspapers to houses in the street. Moving from his home, and every next house which will deliver newspapers must be adjacent to the current house, on the same side of the road, or a house right across the current, on the other side of the road. The same house may be repeatedly deliver newspapers.
Since the street was very long, he had decided to deliver newspapers just some houses. Minimum number of newspapers must be delivered to complete delivering in Slavko's home?
For example, if Mirko's house number 1, a Slavko's number 4, Mirko can immediately cross the road, to deliver a newspapers to a house number 2, and then deliver newspapers to Slavko who is in house number 4 .The only other way to deliver two newspapers is the first to deliver newspapers to a house number 3, and then to cross the road and deliver newspapers to Slavko who is in house number 4.
InputThe first line of input contains Mirko's and Slavko's house number, in that order. Both house number are lower then 100.
OutputThe only line of output print the required number of newspapers.
Input:
Output:
3 1 Output:
1 Input:
Output:
5 4 Output:
2 Input:
Output:
1 4 Output:
2Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.