fn main() { let mut input = String::new(); std::io::stdin().read_line(&mut input).ok(); let input = input .split_whitespace() .map(|x| x.parse::().unwrap()) .collect::>(); let (f0, f1, n) = (input[0], input[1], input[2]); println!( "{}", match n % 3 { 0 => f0, 1 => f1, 2 => f0 ^ f1, _ => panic!(), } ); }