Under construction

Still being built. Things may change

Dominoes

Interview

Time limit1sMemory limit128 MB

Summary
Given N, compute the total dot count across all unique dominoes with halves ranging from 0 to N.
Level

Easy2 of 10

Topics
Math, Combinatorics
Solved
No attempts yet

Problem

A domino is a tile used in many tile games. Each domino has two halves, and each half may have zero or more dots.

In a domino set of size N, each half can contain from 0 to N dots. Two dominoes are considered the same if the two dot counts match, regardless of order. For example, a domino with 2 dots on one half and 8 dots on the other is the same as a domino with 8 dots and 2 dots.

A domino set of size N contains every possible domino exactly once. The following image shows a domino set of size 2.

Given N, compute the total number of dots printed on all dominoes in the set of size N.

Input

The first line contains the size N of the domino set.

  • 1 <= N <= 1000

Output

Print the total number of dots printed on all dominoes in the domino set of size N.

Examples3

  1. Example 1

    Input
    2
    
    Expected output
    12
    
  2. Example 2

    Input
    3
    
    Expected output
    30
    
  3. Example 3

    Input
    15
    
    Expected output
    2040