Method for producing paper, paperboard and cardboard