1. 


/**
* Angewandte Mathematik, SS11
* Problem: 10302 Summation of Polynominals
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=15&page=show_problem&problem=1243
* @author Unverzahrt Michael
* @author Wurth Manuel
* @version 1.0, 11/05/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.176
*/


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;


public class Main {
public static void main(String[] args) throws Exception {
String inputLine;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
while((inputLine = reader.readLine())!=null)
{
if(inputLine.equals(0)) break;
BigInteger n = new BigInteger(inputLine);
//1^3 + 2^3 + 3^3 + ... + (n-1)^3 + n^3 = ((n*n+1)/2)^2
System.out.println((n.multiply(n.add(BigInteger.ONE)).divide(BigInteger.valueOf(2)).pow(2)));
}
}
}

2.

/**
* Angewandte Mathematik, SS11
* Problem: 10302 - Summation of Polynomials
* Link:
*
* @author Schramm, Felix
* @author Vogel, Johannes
* @version 1.0, 05/16/2011
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 0.252
*/

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while(input.hasNextInt()){
long n = input.nextLong();
n=(n*(n+1)/2);
System.out.println(n*n);
}

}

}

3.
/**

* Angewandte Mathematik, SS11

* Problem: 10302 - Summation of Polynomials

* Link:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&categor
y=15&page=show_problem&problem=1243

* @author Brielbeck, Daniel

* @author Weber, Georg

* @version 1.0, 05/10/2011

* Method : Ad-Hoc

* Status : Accepted

* Runtime: 0.184

*/

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.math.BigInteger;



public class Main {

public static void main(String[] args) throws Exception {

BufferedReader in = new BufferedReader(new
InputStreamReader(System.in));

String input;

while ((input = in.readLine()) != null) {

int x = Integer.parseInt(input);

if (x == 0) break;

function(x);

}

}



static void function(int x) {

BigInteger sum = BigInteger.valueOf(0);

BigInteger n = BigInteger.valueOf(x);

//Formel: (n*n*(n+1)*(n+1))/4;

sum=(n.multiply(n).multiply(n.add(new
BigInteger("1"))).multiply(n.add(new BigInteger("1"))).divide(new
BigInteger("4")));

System.out.println(sum);

}

}