WALL.ETM, as he cleans up and organizes the depopulated Earth, has come upon some Civil War memorials. He is consolidating the cannonballs into one location, and decides to use pyramids with triangular bases rather than ones with square bases.
In Civil War memorials with cannons and stacks of cannonballs, the cannonballs were sometimes stacked as a four-sided pyramid, with the base as a square of cannonballs with n balls on each side. An alternative is to stack them in a three-sided pyramid, which is in fact one of the Platonic solids, a tetrahedron.
This tetrahedron of cannonballs has a base that is an equilateral triangle of cannonballs with
n balls on each side. The number of balls in that triangle is given simply by adding together the numbers from 1 to
n. On top of each layer (starting from the base) is a triangle with one less ball on each side, up to the top-most layer with a single ball.
Given the number of cannonballs on each side of the base, compute the total number of cannonballs in the entire tetrahedral stack.