private int helper(int n, int m, int[][] men) {

        if (n <= 0 || m <= 0) {
            return 0;
        }

        if (n == 1 && m == 1) {
            return 1;
        }

        if (men[n][m] != 0) {
            return men[n][m];
        } else {
            men[n][m] = helper(n - 1, m, men) + helper(n, m - 1, men);
        }
        return men[n][m];
    }