// -*- coding:utf-8-unix -*- fn main() { input! { t: usize, } for _ in 0..t { input! { n: usize, a: [u32; n], } let mut res = 1u64; for &ae in &a[1..] { let t = 10u64.pow(ae.to_string().len() as u32); let b = t / t.gcd(&(ae as u64)); res = res.lcm(&b); } println!("{}", res); } } #[allow(unused_imports)] use { itertools::*, num::*, proconio::input, std::{ cmp::*, collections::*, io::{BufReader, BufWriter, Write, stderr, stdin, stdout}, }, }; #[allow(dead_code)] trait Change { fn chmax(&mut self, x: Self); fn chmin(&mut self, x: Self); } impl Change for T { fn chmax(&mut self, x: T) { if *self < x { *self = x; } } fn chmin(&mut self, x: T) { if *self > x { *self = x; } } }