Get reliable answers to your questions at Westonci.ca, where our knowledgeable community is always ready to help. Discover solutions to your questions from experienced professionals across multiple fields on our comprehensive Q&A platform. Join our Q&A platform to connect with experts dedicated to providing accurate answers to your questions in various fields.

You need to get to the mall to buy some new shoes, but you're not sure how to get there. Your city is a n×m rectangular grid of blocks, where your home is located at the coordinates (x1,y1) and the mall's location is (xz,y2). Since you're not sure exactly how to get to the mall, you follow a movement strategy based on these rules: - Move diagonally on each move, starting in the direction (+1,+1). It means that standing at a cell with coordinates ( x, y ) , you'll move to the cell with coordinates (x+1,y+1) unless the new cell is outside the city grid, - If the current move would take you outside the city grid, come back and reverse the direction that was leading outside the grid (eg: if the x coordinate is outside the grid, reverse the x movement direction), - If the current move would escape the city grid outside of a corner, reverse both directions. Your task is to determine how many steps it will take to reach the mall at (x2,y2). Return −1 if it's not possible to reach the mall using this strategy.