Problem Statement  
You are currently at a point (x,y) inside a rectangle. The rectangle's bottom left corner is at (0,0) and its top right corner is at (w,h). Return the shortest distance you must travel in order to reach the rectangle's boundary.  
Definition  
 
Constraints  
  w and h will be between 2 and 1000, inclusive.  
  x will be between 1 and w  1, inclusive.  
  y will be between 1 and h  1, inclusive.  
Examples  
0)  
 
1)  
 
2)  
 
3)  
