import std.algorithm, std.array, std.range; import std.string, std.conv; import std.math; import std.stdio, std.typecons; void main() { auto rd = readln.split.map!(to!long); auto f = rd[0..2].array; auto n = rd[2]; f ~= f[0] ^ f[1]; writeln(f[n % 3]); }