#include <stdio.h>
int main() {
unsigned int reg;
int pos, mode;
// Input
scanf("%u %d %d", ®, &pos, &mode);
if (mode == 1) {
// Set the bit
reg = reg | (1 << pos);
} else {
// Clear the bit
reg = reg & ~(1 << pos);
}
// Output
printf("%u", reg);
return 0;
}