use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); for s in s.lines().skip(1) { let r = match &s[1..2.min(s.len())] { "b" => 2, "o" => 8, "x" => 16, _ => 0, }; println!( "{:?}", match r { 0 => s.parse(), r => u64::from_str_radix(&s[2..], r), } .unwrap() ) } }