Count sum after deleting element