fn main() { let mut t = String::new(); std::io::stdin().read_line(&mut t).ok(); let t: usize = t.trim().parse().unwrap(); let queries = (0..t).map(|_| { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); n }) .collect::>(); for &n in queries.iter() { println!("{}", 2 * n * (n * n - 3 * n + 2) / 3); } }