On a warm spring day, Tony ventures into one of Unionville's many parks. The park can be modelled as a
Tony is currently standing at
Fortunately, Tony has an unlimited supply of trees which he can place on different cells to make his journey longer. Tony cannot move to a cell that has a tree, and he must make sure that a path from
Note: Tony cannot place a tree on the starting cell
Constraints
Input Specification
The first line contains one integer,
Output Specification
Output the maximum possible length of the shortest path from
Sample Input 1
4
Sample Output 1
5
Explanation for Sample Input 1
Note that other possible configurations exist.
Sample Input 2
12
Sample Output 2
17
Comments
Hard version: https://dmoj.ca/problem/wc16c3s3