Solve Summing Pieces

Sum the total values of all piece arrays of $A$. Solving code challenges on HackerRank is one of the best ways to prepare for programming interviews.