Table of numbers
You are given a
Your task is to find the minimum cost when you move from the top left corner to the bottom right corner of the table, and the number of paths with that cost.
Input
The first line contains two integer
The next
Output
Two integers, respectively are the minimum cost and number of paths with that cost.
Note: It is guaranteed that the number of paths is positive and does not greater than
Subtask
Example
Input:
3 5
1 1 1 2 5
5 9 1 1 0
8 0 1 1 1
Output:
7 2
Comments
Toang
:) , update :>