n = gets.to_i n.times{ p = gets.to_i count = 0 (1..p-1).each{ |i| count += i * ( i - 1 ) } puts count * 2 }