Ornaments
Time limit1sMemory limit1024 MB
Given the number of layers, find the total ornaments in a triangular pyramid where layer k holds k(k+1)/2 balls.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
You work at the local mall and must set up the Christmas ornament display. The display is a triangular pyramid. The top layer has one ball, the second layer from the top has three, and each lower layer has more. The side length of each layer equals its layer number. Write a program that takes the number of layers and finds the total number of ornaments in the pyramid.

Input
The first line contains a single integer n, the number of data sets. Each of the following data sets is one line with one integer, the number of layers in the pyramid.
Output
For each data set, output the total number of ornaments in the pyramid.