This page is still under construction.

Parts of this page are still being built. What you see may change.

XORXORXOR

Interview

Time limit0.2sMemory limit512 MB

Summary
XOR the value B into A exactly C times and print the result.
Level

Easy2 of 10

Topics
Bit manipulation, Math
Solved
No attempts yet

Problem

You are given three integers AA, BB, and CC. Start from AA and repeat the operation "XOR the current value with BB" exactly CC times.

In other words, print the value of (⋯((A⊕B)⊕B)⋯ )⊕B(\cdots((A \oplus B) \oplus B) \cdots) \oplus B, where ⊕B\oplus B appears CC times. Here ⊕\oplus is the bitwise exclusive or.

Input

The first line contains AA, BB, and CC separated by spaces. (0<A,B,C≤1090 < A, B, C \le 10^9)

Output

Print the computed result as a single integer on the first line.

Examples2

  1. Example 1

    Input
    13 3 1
    
    Expected output
    14
    
  2. Example 2

    Input
    13 3 2
    
    Expected output
    13