1. 

/*
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #10213 How Many Pieces of Land?
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=14&problem=1154&mosmsg=Submission+received+with+ID+7180719
*
* @author Lermer Florian
* @author Sayli Hidir
* @author Taskin Umut
* @version 0.0.1.5.1.0,
*
* Status : Accepted
* Runtime: 0696
*
*/

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

public class Main {

/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int s;
s=Integer.parseInt(br.readLine());
while(s!=0)
{
s--;
System.out.println(f(new BigInteger(br.readLine())).toString());
}
}

private static BigInteger f(BigInteger n)
{
BigInteger x=new BigInteger("1");
BigInteger z,y=new BigInteger("0");
if(n.compareTo(new BigInteger("3"))>0)
{
x=n.multiply(n.subtract(new BigInteger("1"))).multiply(n.subtract(new BigInteger("2"))).multiply(n.subtract(new BigInteger("3")));
}
z=x.divide(new BigInteger("24"));
if(n.compareTo(new BigInteger("1"))>0)
{
y=n.multiply(n.subtract(new BigInteger("1"))).divide(new BigInteger("2"));
}
return y.add(z.add(new BigInteger("1")));
}
}


2.

/* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #10213 (How Many Pieces of Land ?)
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=14&page=show_problem&problem=1154
*
* @author Dennis Wilfert
* @author Johann Studt
* @version 1.0, 06/08/2009
*
* Status : Accepted
* Runtime: 0.568
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {

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

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
StringBuilder output = new StringBuilder();
// Ergebnis
BigInteger pieces;
// Eingelesene Zahl
BigInteger points;
// Anzahl der Testfälle
int cases = Integer.parseInt(reader.readLine());

while(cases > 0)
{
// Wert einlesen
points = new BigInteger(reader.readLine());
// Maximale Anzahl der Felder berechnen nach der Formel ((n-1)*n*(n*n-5*n+18))/24+1
pieces = ((points.subtract(BigInteger.ONE))
.multiply(points)
.multiply(
(points.multiply(points))
.subtract(BigInteger.valueOf(5).multiply(points))
.add(BigInteger.valueOf(18)))
).divide(BigInteger.valueOf(24))
.add(BigInteger.ONE);
// In die Ausgabe schreiben
output.append(pieces);
output.append("\n");
cases--;
}
System.out.print(output);

}

}