class for calculation max and sum values