added a fourth variable to sum up the arrays.