Stanley Megan decide shop crossmarket grocery store represent matrix n row m column Stanley Megan adjacent cell 1 unit power two cell consider adjacent share edge to speed shopping process Megan bring portal leave cell visit portal if person Stanley Megan cell portal person use 1 unit power teleport cell portal include Megans start cellThey decide split Stanley upperleft cell cell coordinate 1 1 lowerright cell cell coordinate n m whilst Megan need lowerleft cell cell coordinate n 1 upperright cell cell coordinate 1 mWhat minimum total energy need thatnote choose time Time affect energy