Given an n x m matrix A where one needs to traverse from A[0][0] to A[n - 1][m - 1]. From a given cell [i][j], we could only move to the cell to the right or below the current cell, i.e., A[i+1][j] or A[i][j+1]. Each valid path has an associated cost, which is defined to be the sum of all the cells in the path (including the two end cells). We are interested in the path with the lowest cost. Note that there could be multiple such paths with the lowest cost. Design a dynamic programming algorithm that outputs the total number of paths that have the lowest cost.