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

Задача 22016. Minimum path in table


Задача

Темы:
In an NxM rectangular table (each cell contains  
some number) at the beginning the player is in the upper left cell.
In one move, he is allowed to move to the next cell 
either right or down (left and up are not allowed).
When passing through a cell, the player is charged as much c.u. as the number
written in this cell (money is also taken for the first
and the last cell of its path).
 
It is required to find the minimum amount of c.u., by paying which the player can
get to the bottom right corner.
 
Input data
The input file contains two numbers N and M - the size of the table (1<=N<=20,
1<=M<=20). Then comes N lines of M numbers each - the size of the fines
in c.u. for passing through the corresponding cells (numbers from 0 to 100).
 
Output
In the output file, write down the minimum amount you can spend by spending
to the lower right corner.
 
Sample input file
3 4
1 1 1 1