max sum functional