Summing Pieces | HackerRank

Sum the total values of all piece arrays of $A$.