calculating max energy and max goal along other activities