f0,f1,n=STDIN.gets.split(" ") f0=f0.to_i f1=f1.to_i n=n.to_i case n%3 when 0 puts f0 when 1 puts f1 when 2 puts f0^f1 end