list($f[0], $f[1], $n) = explode(' ',trim(fgets(STDIN))); $f[2] = (int)$f[0] ^ (int)$f[1]; $n %= 3; echo $f[$n].PHP_EOL;