Coupled-cluster method for multideterminantal reference states