complete sum() and max() by foreach
complete sum() and max() by foreach