// -*- coding:utf-8-unix -*- #[allow(unused_imports)] use std::io::{BufReader, BufWriter, Write, stdin, stdout, stderr}; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use num::*; #[allow(unused_imports)] use proconio::input; #[allow(unused_imports)] use itertools::*; #[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; } } } fn main() { input! { t: usize, } for _ in 0..t { input! { n: usize, a: [u32; n], } let mut res = 1u64; for ae in a[1..].iter().map(|&x| x as u64) { let alen = ae.to_string().len() as u32; let b = 10u64.pow(alen) / 10u64.pow(alen).gcd(&ae); res = res.lcm(&b); } println!("{}", res); } }