public static void main(String[] args) throws IOException {
    int [][] matrix =getMatrix(Utils.readFile("../50_99/src/task81_83/matrix1.txt"));
    for (int i = 0; i < matrix.length; i++) {
        for (int j = 0; j < matrix.length; j++) {
            if ((i > 0)&&(j > 0)) {
                matrix[i][j] += Math.min(matrix[i][j-1], matrix[i-1][j]);
            }else if ((i == 0) && (j > 0)) {
                matrix[i][j] += matrix[i][j-1];
            }else if ((i > 0) && (j == 0)) {
                matrix[i][j] += matrix[i-1][j];
            }
        }
    }
    System.out.println(matrix[matrix.length-1][matrix.length-1]);
}