fn main() { input!{ a: i64, b: usize, } // ax^b を x^2+x+1で割った余り let mut dp = vec![0i64; b+9]; dp[b] = a; for i in (2..=b).rev() { if dp[i] != 0 { let val = dp[i]; dp[i] = 0; dp[i-1] = dp[i-1] - val; dp[i-2] = dp[i-2] - val; } } println!("{} {}", dp[1], dp[0]); } // const MOD17: usize = 1000000007; // const MOD93: usize = 998244353; // const INF: usize = 1 << 60; // let dx = vec![!0, 0, 1, 0]; // 上左下右 // let dy = vec![0, !0, 0, 1]; // 上左下右 // let d = vec!{(!0, 0), (0, !0), (1, 0), (0, 1)}; // 上左下右 #[allow(unused)] use proconio::{input, marker::Chars, marker::Usize1}; #[allow(unused)] use std::{ mem::swap, cmp::min, cmp::max, cmp::Reverse, collections::HashSet, collections::BTreeSet, collections::HashMap, collections::BTreeMap, collections::BinaryHeap, collections::VecDeque, iter::FromIterator, };