Cost functions for University teaching and research