Олимпиадный тренинг

Задача 39309. Error


Задача

Темы: ЕГЭ
The square is lined with N × N cells (1 < N < 30). The EM performer can move around the cells by performing one of two commands in one move: left or down. On command left EMU moves to the adjacent left cell, on command down – to the adjacent lower one. The square is bounded by external walls. There can also be internal walls between adjacent square cells. EMU cannot pass through walls. 
At the initial moment of time, the EMU has a supply of fruits equal to the number written in the starting cell. When moving from cell to cell, EMU eats a certain number of fruits. When moving to the left, the EMU eats as many fruits as it is written in the cell to which it moves, plus 5 more. When moving down, the EMU eats the amount of fruit that is 2 times less than the number recorded in the cell to which it moves, and, at the same time, if the cell contains an even number, otherwise he eats only one fruit. Determine the maximum and minimum number of fruits that the EST has in stock by going from the top right square (starting square) to the bottom left.
Answer two numbers – first the maximum number, then the minimum. Both numbers are specified on the same line, separated by one space.
The source data is a spreadsheet of  N × N, each cell of which corresponds to a square cell. Inner & nbsp;  outer walls are marked with thick lines.