CF491B New York Hotel

Description

Think of New York as a rectangular grid consisting of $ N $ vertical avenues numerated from $ 1 $ to $ N $ and $ M $ horizontal streets numerated $ 1 $ to $ M $ . $ C $ friends are staying at $ C $ hotels located at some street-avenue crossings. They are going to celebrate birthday of one of them in the one of $ H $ restaurants also located at some street-avenue crossings. They also want that the maximum distance covered by one of them while traveling to the restaurant to be minimum possible. Help friends choose optimal restaurant for a celebration. Suppose that the distance between neighboring crossings are all the same equal to one kilometer.

Input Format

N/A

Output Format

N/A