Under construction

Still being built. Things may change

Sum of Cubes

Time limit0.25sMemory limit1024 MB

Summary
Given N, the task prints the sum 1 to N, its square, and the sum of cubes 1 to N.
Level

Easy1 of 10

Topics
Implementation, Math
Solved
No attempts yet

Problem

Class taught Eunha the following formula relating the sum of the integers from 11 to NN and the sum of their cubes.

  • (1+2+⋯+N)2=13+23+⋯+N3(1 + 2 + \cdots + N)^2 = 1^3 + 2^3 + \cdots + N^3

Eunha found this hard to believe, so she decided to check it by writing code. Print the sum of the integers from 11 to NN, then the square of that sum, then the sum of the cubes of the integers from 11 to NN, in that order.

Input

The first line contains an integer NN. (5≤N≤100)(5 \le N \le 100)

Output

Print three lines.

  • Line 1: the sum 1+2+⋯+N1+2+\cdots+N.
  • Line 2: the square of that sum, (1+2+⋯+N)2(1+2+\cdots+N)^2.
  • Line 3: the sum of cubes 13+23+⋯+N31^3+2^3+\cdots+N^3.

Hint

The square of aa is aa multiplied by itself twice, written a2a^2. a2=a×aa^2 = a \times a.

The cube of aa is aa multiplied by itself three times, written a3a^3. a3=a×a×aa^3 = a \times a \times a.

Examples2

  1. Example 1

    Input
    5
    
    Expected output
    15
    225
    225
    
  2. Example 2

    Input
    100
    
    Expected output
    5050
    25502500
    25502500