use proconio::{input, marker::Usize1}; fn main() { input! { mut n:usize, mut k:Usize1, } let mut ans = vec![]; while n > 0 { ans.push(k % (n % 10 + 1)); k /= n % 10 + 1; n /= 10; } ans.reverse(); if ans.iter().all(|x| *x == 0) { println!("0"); } else { for x in ans.iter().skip_while(|x| **x == 0) { print!("{}", *x); } println!() } }