use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input).ok(); let mut input = input.split_whitespace(); let f0 = input.next().unwrap().parse::().unwrap(); let f1 = input.next().unwrap().parse::().unwrap(); let n = input.next().unwrap().parse::().unwrap(); let f = [f0, f1, f0 ^ f1]; println!("{}", f[(n % 3) as usize]); }