def read_mtx_file(path: str):
    """
    Reads mtx file data.

    :param path: Path and name of the file with data
    :return: shape of the matrix, rows data, columns data, number of values
    """

    with open(str(path), 'r') as file:
        line = file.readline()
        while line[0].startswith("#"):
            line = file.readline()

        m, n, nvals = map(int, line.split())
        rows = list()
        cols = list()
        for k in range(nvals):
            line = file.readline()
            if line.startswith("#"):
                continue

            i, j = map(int, line.split())
            rows.append(i)
            cols.append(j)

    return (m, n), rows, cols, nvals