use std::collections::{HashMap, HashSet}; fn main() { proconio::input! { n: String, m: String, } let n = n.chars().last().unwrap().to_digit(10).unwrap(); let m = m.chars().last().unwrap().to_digit(10).unwrap() + 10; println!("{}", pow_mod10(n, m)); } fn pow_mod10(mut x: u32, mut y: u32) -> u32 { let p = 10; let mut res = 1; x %= p; while y > 0 { if y & 1 == 1 { res = (res * x) % p; } y >>= 1; x = (x * x) % p; } res }