import std.stdio, std.string, std.conv, std.algorithm, std.array; void main(){ ulong[3] n = readln.strip.split.map!(to!ulong).array; auto s = n[2]; n[2] = n[0] ^ n[1]; n[s%3].writeln; }